_Your high-performance gateway for handling millions of requests with ultra-low latency
Amazon Network Load Balancer represents AWS's Layer 4 load balancing solution, designed to handle the most demanding workloads while maintaining exceptional performance. Operating at the connection level (TCP/UDP), it serves as your network's traffic conductor, efficiently distributing incoming requests across multiple targets, such as EC2 instances, containers, and IP addresses. In other words Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. It monitors the health of its registered targets, and routes traffic only to the healthy targets. Elastic Load Balancing scales your load balancer as your incoming traffic changes over time. It can automatically scale to the vast majority of workloads. Some of the components of NLB are:
- Load balancers: Listeners define how NLB handles incoming traffic by specifying the protocol and port.
- Listeners: Backend resources (e.g., EC2 instances) are grouped into target groups. NLB directs traffic to targets within these groups.
- Target groups: Periodic health checks ensure only healthy targets receive traffic.
Example: Think of NLB as a highly efficient traffic controller at a busy airport. Just as an air traffic controller needs to handle multiple aircraft simultaneously while ensuring minimal delays, NLB manages millions of requests per second while maintaining consistent, low-latency connections. Its ability to preserve source IP addresses and maintain static IP endpoints makes it particularly valuable for applications requiring precise network control and predictable addressing.
How Does It Work?
The Network Load Balancer routes incoming client requests to backend targets (e.g., EC2 instances, IP addresses, or containers) based on predefined rules. It uses static IP addresses for consistent endpoint management and performs health checks to ensure traffic is only sent to healthy targets.
Let's try to understand the flow with an example:
Flow Example: With Two EC2 Instances
-
Incoming Request:
- A client sends an HTTPS request to
https://example.com
(NLB’s endpoint).
- A client sends an HTTPS request to
-
NLB Listeners:
- Listener on port 443 identifies the request and routes it to Target Group A.
-
Target Group A:
- Contains EC2 Instance 1 and EC2 Instance 2.
-
Health Check:
- NLB checks if both instances are healthy:
- EC2 Instance 1: Healthy ✅
- EC2 Instance 2: Healthy ✅
- NLB checks if both instances are healthy:
-
Traffic Routing:
- NLB sends the request to EC2 Instance 1 (based on load distribution).
- If EC2 Instance 1 is busy or fails health checks later, NLB will route traffic to EC2 Instance 2.
-
Response to Client:
- EC2 Instance 1 processes the request and sends the response back via the NLB to the client.
Key Features of AWS Network Load Balancer (NLB)
Ultra-Low Latency : NLB is designed to handle millions of requests per second with minimal latency, making it ideal for latency-sensitive applications.
TCP, UDP, and TLS Support : Supports multiple transport protocols, including TCP for general-purpose traffic, UDP for real-time applications, and TLS for secure connections with built-in TLS termination.
Static IP Addresses and Elastic IPs : Assigns static IP addresses to each load balancer, simplifying DNS configurations and providing consistent endpoints. Elastic IPs can also be used for better control over IP allocation.
Cross-Zone Load Balancing : Distributes traffic evenly across targets in multiple Availability Zones (AZs), ensuring reliability and high availability.
IP Address Targeting : Routes traffic directly to targets using private IP addresses, enabling seamless integration with on-premises and hybrid cloud environments.
Health Checks : Continuously monitors the health of registered targets and routes traffic only to healthy instances, ensuring high reliability.
Scalability: Automatically scales to handle traffic spikes, supporting millions of connections without manual intervention.
Integration with Other AWS Services: Works seamlessly with AWS services like Amazon ECS, Amazon EKS, and AWS CloudFormation for automated deployments.
How NLB is different from Other Load Balancer
When compared to its siblings in the AWS load balancer family, NLB stands out for its raw performance capabilities. While Application Load Balancer (ALB) excels at HTTP-level routing and Classic Load Balancer (CLB) offers basic load balancing, NLB specializes in high-throughput, low-latency scenarios where every millisecond counts.
A key distinguishing feature is its ability to handle both TCP and UDP protocols, making it the go-to choice for applications like gaming servers, IoT devices, and media streaming platforms where consistent, high-speed performance is crucial.
REAL WORLD APPLICATIONS
- Gaming Servers: Handle high-speed, real-time connections for multiplayer games.
- IoT Applications: Efficiently manage millions of device connections.
- Financial Services: Provide low-latency, secure connections for financial transactions.
- Web Applications: Distribute traffic across multiple servers to ensure reliability and high availability.
- Microservices: Direct traffic between containerized applications on ECS or EKS.
- Content Delivery : Directs incoming requests to geographically distributed resources, improving response times for content-heavy applications.
Benefits of migrating from a Classic Load Balancer
Using a Network Load Balancer instead of a Classic Load Balancer has the following benefits:
Ability to handle volatile workloads and scale to millions of requests per second.
Support for static IP addresses for the load balancer. You can also assign one Elastic IP address per subnet enabled for the load balancer.
Support for registering targets by IP address, including targets outside the VPC for the load balancer.
Support for routing requests to multiple applications on a single EC2 instance. You can register each instance or IP address with the same target group using multiple ports.
Support for containerized applications. Amazon Elastic Container Service (Amazon ECS) can select an unused port when scheduling a task and register the task with a target group using this port. This enables you to make efficient use of your clusters.
Support for monitoring the health of each service independently, as health checks are defined at the target group level and many Amazon CloudWatch metrics are reported at the target group level. Attaching a target group to an Auto Scaling group enables you to scale each service dynamically based on demand.
Pricing
The pricing model for NLB is based on the following components:
- Load Balancer Hours: Charges apply for each hour or partial hour the load balancer is active.
- Data Processing Charges: Billed per GB of data processed through the load balancer.
- Optional Features: Additional costs for cross-zone load balancing or using static IPs. For detailed pricing, visit the AWS Pricing Page for Network Load Balancer.
Limitations and Challenges
- Protocol Constraints: Only operates at Layer 4; for advanced HTTP/HTTPS routing, use Application Load Balancer (ALB).
- Learning Curve: Requires understanding network configurations to utilize it effectively.
- Additional Costs: High data processing requirements can lead to increased costs.
Real-World Example: Online Streaming Platform
Scenario
A popular online streaming platform needed a reliable and high-performance load-balancing solution to handle millions of concurrent viewers globally while ensuring minimal latency and uninterrupted service.
How It Is Used
-
Traffic Distribution:
- The AWS Network Load Balancer directs incoming TCP traffic from viewers to multiple backend media servers located in various AWS Availability Zones.
-
Health Monitoring:
- Continuous health checks ensure only healthy servers receive traffic, preventing downtime for users.
-
Scalability:
- NLB automatically scales to manage traffic spikes during popular live events, such as sports or concerts, without requiring manual intervention.
-
Static IP and Elastic IPs:
- The platform uses NLB's static IPs to simplify DNS configurations for consistent endpoints across their global user base.
-
TLS Termination:
- NLB terminates TLS connections at the load balancer, offloading encryption overhead from backend servers, improving performance.
Outcome
- The platform achieved low-latency streaming for millions of users.
- High availability ensured no disruptions during traffic surges.
- Simplified operations with automated scalability and static IPs.
Example: Similar use cases include video streaming platforms like Netflix or Twitch, which rely on high-performance load balancers for seamless user experiences.
Top comments (0)