Tech Matchups: ALB vs NLB vs CLB
Overview
Application Load Balancer (ALB) operates at OSI Layer 7, routing HTTP/HTTPS traffic with advanced features like path-based routing.
Network Load Balancer (NLB) operates at Layer 4, handling TCP/UDP traffic with ultra-low latency and static IPs.
Classic Load Balancer (CLB) supports both Layer 4 and 7, but lacks modern features, used for legacy applications.
All distribute traffic: ALB for web apps, NLB for performance, CLB for old setups.
Section 1 - OSI Layer and Protocols
ALB (Layer 7) inspects HTTP headers—e.g., routing /api to one target group, /web to another. Supports HTTPS termination and WebSockets. Example:
NLB (Layer 4) routes TCP/UDP packets without inspecting content, ideal for low-latency apps like gaming. Provides static IPs. Example:
CLB (Layer 4/7) supports basic HTTP and TCP routing but lacks advanced features like path-based routing. Example:
Scenario: ALB routes a web app; NLB serves a VoIP service; CLB supports an old EC2 app.
Section 2 - Features and Capabilities
ALB offers path-based routing, host-based routing, and WAF integration—e.g., blocking SQL injection. Supports dynamic port mapping for ECS.
NLB provides ultra-low latency (~100ms), static IPs, and TLS termination—e.g., for IoT devices. Handles millions of requests/second.
CLB lacks modern features, with basic health checks and no container support. Limited to EC2-Classic or simple VPC setups.
Scenario: ALB powers a microservices app; NLB serves high-frequency trading; CLB runs a 2010-era app.
Section 3 - Pricing and Performance
ALB charges per hour ($0.0225 in us-east-1) plus LCU (Load Balancer Capacity Units, ~$0.008/LCU). Example: 1M HTTP requests/day costs ~$20/month.
NLB charges per hour ($0.0225) plus NCU (Network Capacity Units, ~$0.006/NCU). Example: 1Gbps TCP traffic costs ~$25/month.
CLB charges per hour ($0.025) plus data processed ($0.008/GB). Example: 1TB/month traffic costs ~$30/month.
Scenario: ALB is cost-effective for web apps; NLB for high-throughput TCP; CLB for legacy cost savings.
Section 4 - Use Case Scenarios
ALB suits web applications—e.g., routing user requests to microservices or Lambda functions. Ideal for REST APIs or serverless.
NLB fits high-performance apps—e.g., real-time analytics or gaming servers needing static IPs and low latency.
CLB supports legacy apps—e.g., EC2-Classic setups without VPC or pre-2016 architectures.
Scenario: ALB for an e-commerce site; NLB for a streaming platform; CLB for an old CRM system.
Section 5 - Comparison Table
Aspect | ALB | NLB | CLB |
---|---|---|---|
Layer | 7 (HTTP/HTTPS) | 4 (TCP/UDP) | 4/7 |
Features | Path-based, WAF | Static IPs, Low Latency | Basic Routing |
Performance | High | Ultra-High | Moderate |
Cost | LCU-based | NCU-based | Data-based |
Best For | Web Apps | Low-Latency Apps | Legacy Apps |
ALB for modern web, NLB for performance, CLB for legacy. Choose based on app needs.
Conclusion
ALB, NLB, and CLB serve distinct load balancing needs. ALB excels in HTTP-based web apps with advanced routing and security. NLB is ideal for high-performance TCP/UDP apps requiring low latency. CLB suits legacy systems with basic requirements.
Weigh protocol (HTTP vs. TCP), features (routing vs. static IPs), and modernity (new vs. legacy). Use ALB for web, NLB for performance, CLB for old apps—or migrate from CLB to ALB/NLB for modern features.