AWS Network Load Balancingr – NLB
Network Load Balancing – NLB operates at connection level (Layer 4) and routes connections to targets – instances of EC2 and containers based upon IP protocol data.
Network Load Balancing is ideal for TCP traffic load balancing
Network Load Balancer can handle millions of requests per second and maintains ultra-low latency (100ms vs. 400ms for ALB).
Network Load Balancingr is designed to handle volatile and sudden traffic patterns using only one static IP address per Availability zone.
Network Load Balancer supports TLS termination, preserves clients’ source IP, and provides stable IP support as well as Zonal isolation.
NLB supports long-running connections which are very useful to WebSocket-type apps.
NLB can be integrated with other AWS services like Auto Scaling, EC2 Container Service and CloudFormation.
NLB supports connections between clients via VPC peering, AWS managed VPN, and third party VPN solutions.
TCP traffic is handled by the load balancer using a flow algorithm that uses the protocol, source IP address and destination IP address to select a target. The destination port is also selected.
TCP connections can be established from clients with different source ports and sequence number and routed to different targets.
Each TCP connection is routed to one target for the duration of the connection.
UDP traffic is handled by the load balancer using a flow algorithm that uses the protocol, source IP address and source port to select a target.
UDP flows have the same source and destination so they are always routed to the same target throughout their lifetime.
Different UDP flows can be routed to different targets because they have different source IP addresses or ports.
Back-end server authentication is not supported (MTLS).
Session stickiness is not supportedClassic Load Balancing vs. Application Load Balancing vs. Network Loadbalar
Refer Blog Post @ Classic Load Balancer vs Application Load Balancer vs Network Load BalancerNetwork Load Balancer Features
Load Balancing Layer 4 with Connections
High availability
It is readily available.
Accepts traffic from clients and distributes it across the targets within the same AZ (except for Cross-zone load balancencing).
It monitors the health and routes traffic only to healthy targets.
If a health check fails to detect an unhealthy target, it will stop routing traffic to that target and redirect traffic to other healthy targets.
If multiple AZs are configured, and if all targets fail in a single AZ, it routes traffic to the other AZsAvailability zones
It can be used to route traffic through multiple Availability Zones.
Before traffic is routed to AZ, however, AZ must first be enabled.
Even after the NLB is created, AZ can still be enabled.
Once enabled, AZ cannot be removed.
High Throughput
It is designed to handle increasing traffic and can load balance millions upon requests/sec.
Low latency
Cross Zone Load Balancing offers very low latency for latency-sensitive applications
Only after the NLB is created, can cross-zone loading balance be enabled
Inter-az traffic is automatically disabled and subject to charges
Only works with AZs that have been enabled on the AZSticky Sessions
Sticky sessions (source IP affinity), are a way to route requests from one client to another.
Stickiness is defined at target group level Load Balancing using IP addresses to Targets
Allows load balancing of any AWS-hosted application or on-premises application using IP addresses as targets.
All