ALB vs NLB vs CLB in AWS
AWS Elastic Load Balancer (ELB) provides multiple types of load balancers designed for different workloads and networking requirements.
The main AWS load balancer types are:
- Application Load Balancer (ALB)
- Network Load Balancer (NLB)
- Classic Load Balancer (CLB)
Why Different Load Balancers Exist
Different applications require different traffic handling.
Examples
| Application Type | Requirement |
|---|---|
| Web Applications | HTTP routing |
| Gaming Systems | Ultra-low latency TCP |
| Legacy Applications | Basic load balancing |
High-Level Comparison
| Feature | ALB | NLB | CLB |
|---|---|---|---|
| OSI Layer | Layer 7 | Layer 4 | Layer 4 & 7 |
| Main Protocols | HTTP/HTTPS | TCP/UDP/TLS | HTTP/TCP |
| Routing Intelligence | Advanced | Basic | Limited |
| Performance | High | Very High | Moderate |
| AWS Recommendation | Modern Web Apps | High Performance Apps | Legacy Only |
1. Application Load Balancer (ALB)
What is ALB?
ALB is a Layer 7 load balancer designed for:
- HTTP applications
- HTTPS applications
- Microservices
- Containers
- Kubernetes ingress
OSI Layer
Layer 7 — Application Layer
How ALB Works
Users
|
Application Load Balancer
|
Path/Host-Based Routing
|
-------------------------------
| | |
Service-A Service-B Service-C
Key Features of ALB
- Path-based routing
- Host-based routing
- WebSocket support
- HTTP/2 support
- Container integration
- Lambda integration
Path-Based Routing Example
/api → API Service
/orders → Order Service
/payment → Payment Service
Host-Based Routing Example
api.company.com → API Service
admin.company.com → Admin Service
Best Use Cases for ALB
- Microservices architecture
- REST APIs
- Web applications
- Containerized applications
- Kubernetes workloads
Advantages of ALB
- Advanced routing capabilities
- Application-aware traffic management
- Better microservices support
- Modern cloud-native integration
Disadvantages of ALB
- Slightly higher latency than NLB
- Only supports HTTP/HTTPS
2. Network Load Balancer (NLB)
What is NLB?
NLB is a Layer 4 load balancer optimized for:
- Ultra-high performance
- Low latency
- TCP/UDP traffic
OSI Layer
Layer 4 — Transport Layer
How NLB Works
Users
|
Network Load Balancer
|
TCP/UDP Forwarding
|
-----------------------
| | |
Server1 Server2 Server3
Key Features of NLB
- Static IP support
- Ultra-low latency
- Millions of requests per second
- TLS support
- TCP and UDP support
Best Use Cases for NLB
- Gaming applications
- Real-time systems
- Financial systems
- IoT systems
- High-performance APIs
Advantages of NLB
- Extremely high performance
- Very low latency
- Supports non-HTTP traffic
- Static IP addresses
Disadvantages of NLB
- No advanced HTTP routing
- No path-based routing
- No application-layer intelligence
3. Classic Load Balancer (CLB)
What is CLB?
CLB is the older generation AWS load balancer.
It supports:
- Basic HTTP balancing
- Basic TCP balancing
OSI Layer
Layer 4 and Layer 7
Architecture
Users
|
Classic Load Balancer
|
-----------------------
| | |
EC2 EC2 EC2
Limitations of CLB
- No advanced routing
- No microservices support
- No container-native features
- Limited scalability
AWS Recommendation
Use ALB or NLB instead of CLB
Best Use Cases for CLB
- Legacy applications
- Older AWS architectures
Architecture Comparison
ALB Architecture
Internet
|
ALB
|
--------------------------------
| | |
Microservice1 Microservice2 Microservice3
NLB Architecture
Internet
|
NLB
|
-------------------------
| | |
TCP App1 TCP App2 TCP App3
CLB Architecture
Internet
|
CLB
|
----------------------
| | |
EC2 EC2 EC2
Detailed Comparison Table
| Feature | ALB | NLB | CLB |
|---|---|---|---|
| OSI Layer | Layer 7 | Layer 4 | Layer 4 & 7 |
| Protocols | HTTP/HTTPS | TCP/UDP/TLS | HTTP/TCP |
| Path Routing | Yes | No | No |
| Host Routing | Yes | No | No |
| WebSocket Support | Yes | No | No |
| Container Support | Excellent | Good | Limited |
| Latency | Low | Ultra Low | Moderate |
| Static IP | No | Yes | No |
| AWS Recommendation | Preferred | Preferred | Legacy Only |
Production Use Case Examples
ALB Example
E-Commerce Website
|
ALB
|
--------------------------------
| | |
Cart Service Payment Service Order Service
NLB Example
Gaming Platform
|
NLB
|
Real-Time TCP Servers
CLB Example
Legacy Monolithic Application
|
CLB
|
EC2 Instances
Load Balancer Selection Guide
| Requirement | Recommended LB |
|---|---|
| Microservices | ALB |
| Kubernetes Ingress | ALB |
| Ultra-Low Latency | NLB |
| TCP/UDP Traffic | NLB |
| Legacy Applications | CLB |
Security Features Comparison
| Security Feature | ALB | NLB | CLB |
|---|---|---|---|
| SSL/TLS Termination | Yes | Yes | Yes |
| AWS WAF Integration | Yes | Limited | Limited |
| DDoS Protection | Yes | Yes | Yes |
Production Best Practices
- Use ALB for HTTP/HTTPS applications
- Use NLB for TCP/UDP high-performance traffic
- Avoid CLB for new applications
- Enable multi-AZ deployment
- Configure health checks properly
- Use HTTPS and SSL certificates
Common Mistakes
- Using NLB for microservices routing
- Using CLB in modern architectures
- Improper health check configuration
- Ignoring SSL termination optimization
Interview Answer
AWS provides three major load balancer types:
- ALB (Application Load Balancer)
- NLB (Network Load Balancer)
- CLB (Classic Load Balancer)
ALB works at Layer 7 and is mainly used for HTTP/HTTPS web applications, microservices, and Kubernetes workloads.
NLB works at Layer 4 and is optimized for ultra-high performance, low latency, and TCP/UDP traffic.
CLB is the older generation AWS load balancer mainly used for legacy applications.
AWS generally recommends:
- ALB for modern web applications
- NLB for high-performance networking
- Avoid CLB for new architectures
Quick Summary Table
| Load Balancer | Best For |
|---|---|
| ALB | Microservices & Web Apps |
| NLB | High Performance TCP/UDP |
| CLB | Legacy Applications |
Useful Internal Links
- AWS Interview Questions
- Cloud Computing Interview Questions
- DevOps Interview Questions
- Docker Interview Questions
- Kubernetes Interview Questions
Final Conclusion
ALB, NLB, and CLB are designed for different networking requirements in AWS cloud environments.
Modern cloud-native architectures primarily use:
- ALB for intelligent HTTP routing
- NLB for ultra-fast TCP/UDP traffic
CLB is mainly maintained for backward compatibility and legacy workloads.
Choosing the correct load balancer is critical for:
- Application performance
- Scalability
- Security
- Cost optimization
Understanding ALB vs NLB vs CLB deeply is essential for AWS architects, DevOps engineers, cloud engineers, and infrastructure professionals.