Network Load Balancer (NLB) is a high-performance AWS load balancing service designed for:
- Ultra-low latency applications
- TCP traffic
- UDP traffic
- TLS traffic
- Massive-scale workloads
Why Network Load Balancer is Needed
Some applications require:
- Millions of requests per second
- Ultra-low latency
- High throughput
- Non-HTTP protocol support
Examples
- Gaming platforms
- Financial systems
- IoT systems
- Real-time streaming
- Messaging systems
Without NLB
Users
|
Single Server
|
Performance Bottleneck
Problems:
- Traffic overload
- Single point of failure
- High latency
- Scalability limitations
With NLB
Users
|
Network Load Balancer
/ | \
Server1 Server2 Server3
NLB distributes traffic efficiently across multiple backend servers.
OSI Layer
Layer 4 — Transport Layer
NLB operates using:
- TCP
- UDP
- TLS
Main Responsibilities of NLB
| Feature | Purpose |
|---|---|
| Traffic Distribution | Balance TCP/UDP traffic |
| Ultra-Low Latency | Improve performance |
| High Throughput | Handle massive traffic |
| Health Checks | Detect unhealthy targets |
| Static IP Support | Stable networking |
High-Level NLB Architecture
Internet Users
|
Network Load Balancer
|
-----------------------------------------
| | |
Target Group-A Target Group-B Target Group-C
| | |
EC2 Instances Containers IP Targets
How NLB Works Internally
1. Client sends TCP/UDP request
2. DNS resolves NLB endpoint
3. NLB receives traffic
4. Connection forwarded at Layer 4
5. Healthy backend target selected
6. Response returned to client
Core Components of NLB
- Listener
- Target Groups
- Health Checks
- Static IP Addresses
- Availability Zones
1. Listener
Listener defines:
Protocol + Port
Examples
TCP : 443
UDP : 53
TLS : 8443
Architecture
Users
|
Listener : TCP 443
|
Target Group
2. Target Groups
Target groups contain:
- EC2 instances
- Containers
- IP addresses
Architecture
NLB
|
Target Group
|
--------------------------
| | |
Server1 Server2 Server3
3. Health Checks
NLB continuously checks:
Backend target availability
Health Check Types
- TCP health checks
- HTTP health checks
- HTTPS health checks
Health Check Flow
NLB
|
Health Check
|
Healthy Target → Traffic Sent
Unhealthy Target → Traffic Removed
Benefits
- Automatic failure handling
- Improved uptime
- Fault tolerance
Static IP Support
One major feature of NLB:
Static IP addresses
Why Important?
- Firewall whitelisting
- Enterprise networking
- Stable DNS configurations
Architecture
Users
|
Static Public IP
|
NLB
|
Backend Servers
Ultra-Low Latency Design
NLB is optimized for:
High-speed packet forwarding
Benefits
- Minimal processing overhead
- High throughput
- Very fast response times
Connection Handling
NLB handles:
Millions of concurrent connections
Use Cases
- Gaming systems
- Financial trading platforms
- IoT communication
NLB and Auto Scaling
NLB integrates with:
Auto Scaling Groups (ASG)
Architecture
Users
|
NLB
|
Auto Scaling Group
|
-----------------------------------
| | |
EC2 EC2 EC2
Benefits
- Automatic scaling
- Dynamic traffic balancing
- High availability
NLB and Kubernetes
NLB is commonly used with:
- Kubernetes Services
- EKS clusters
Architecture
Internet
|
NLB
|
Kubernetes Services
|
Pods
TLS Support
NLB supports:
TLS termination
Benefits
- Secure encrypted communication
- Centralized certificate management
Cross-Zone Load Balancing
NLB supports:
Traffic balancing across multiple Availability Zones
Architecture
NLB
/ \
AZ-1 AZ-2
/ \ / \
EC2 EC2 EC2 EC2
Benefits
- Disaster resilience
- Fault tolerance
- High availability
NLB Security Features
- TLS encryption
- AWS Shield integration
- Security group support
- Private networking support
Monitoring NLB
NLB integrates with:
- CloudWatch
- CloudTrail
- VPC Flow Logs
Important Metrics
- Active connections
- Processed bytes
- Target health status
- TCP reset count
Production Best Practices
- Use NLB for TCP/UDP workloads
- Enable cross-zone balancing
- Configure proper health checks
- Use Auto Scaling integration
- Monitor latency metrics
- Use TLS for secure traffic
Common Production Problems
- Improper TCP health checks
- Backend timeout issues
- Cross-zone imbalance
- Connection exhaustion
- Incorrect target registration
Production-Grade NLB Architecture
Internet Users
|
AWS Shield
|
Network Load Balancer
|
------------------------------------------------
| | |
TCP Service-A TCP Service-B TCP Service-C
|
Auto Scaling Groups
|
Databases / Messaging Systems
Real-World Example
Online Gaming Platform
Players
|
NLB
|
-----------------------------------------
| | |
Game Server-1 Game Server-2 Game Server-3
Benefits:
- Low latency gameplay
- High concurrency support
- Fault tolerance
Advantages of NLB
- Ultra-high performance
- Very low latency
- Static IP support
- Massive scalability
- Supports TCP and UDP
Disadvantages of NLB
- No Layer 7 routing
- No path-based routing
- Limited HTTP intelligence
- No advanced application routing
Interview Answer
Network Load Balancer (NLB) is a Layer 4 AWS load balancer designed for:
- TCP traffic
- UDP traffic
- TLS traffic
NLB is optimized for:
- Ultra-low latency
- High throughput
- Millions of concurrent connections
It supports:
- Static IP addresses
- Cross-zone load balancing
- Health checks
- Auto Scaling integration
NLB is commonly used in:
- Gaming platforms
- Financial systems
- IoT architectures
- Real-time applications
Quick Summary Table
| Feature | NLB Capability |
|---|---|
| OSI Layer | Layer 4 |
| Protocols | TCP/UDP/TLS |
| Latency | Ultra Low |
| Static IP | Supported |
| Path Routing | Not Supported |
| Performance | Very High |
Useful Internal Links
- AWS Interview Questions
- Cloud Computing Interview Questions
- DevOps Interview Questions
- Docker Interview Questions
- Kubernetes Interview Questions
Final Conclusion
Network Load Balancer (NLB) is a critical AWS networking service designed for:
- Extreme performance
- Ultra-low latency
- Massive-scale TCP/UDP traffic
It is widely used in production systems that require:
- Real-time communication
- High throughput
- Low latency networking
- Stable static IP support
Modern cloud architectures heavily rely on NLB for:
- Gaming
- Financial platforms
- IoT communication
- High-performance APIs
Understanding NLB deeply is essential for AWS architects, DevOps engineers, cloud engineers, and infrastructure professionals.