ALB vs NLB
Compare Layer 7 application load balancing with Layer 4 network load balancing in AWS.
Networking
Application Load Balancer
ALB is a Layer 7 load balancer for HTTP and HTTPS traffic. It supports host-based routing, path-based routing, and application-aware traffic distribution.
Networking
Network Load Balancer
NLB is a Layer 4 load balancer designed for TCP, UDP, and high-performance network traffic handling. It focuses on speed, scale, and low-latency transport-level balancing.
Key Differences
ALB operates at Layer 7 and understands HTTP and HTTPS, while NLB operates at Layer 4 and handles lower-level network traffic.
ALB supports host-based and path-based routing, while NLB focuses on transport-level forwarding.
NLB is typically stronger for very high-performance low-latency TCP or UDP workloads, while ALB is stronger for web applications.
ALB provides richer application-aware features, while NLB provides simpler and faster network-level handling.
ALB is the usual choice for web and API routing, while NLB is the usual choice for raw network services.
Choosing between them depends on traffic type and routing needs, not just load-balancer preference.
When to Use
When to use ALB
Use ALB for web applications, APIs, HTTP and HTTPS traffic, and routing scenarios that require host-based or path-based logic.
When to use NLB
Use NLB for TCP or UDP workloads, very high-throughput traffic, static-network-oriented requirements, or low-latency transport balancing.
Tradeoffs
ALB gives richer application features, but is not designed for all raw network use cases.
NLB gives strong performance and lower-level handling, but lacks the HTTP-aware routing features of ALB.
ALB is smarter for web traffic, while NLB is stronger for transport-level performance.
Common Mistakes
Choosing NLB for a web app that clearly needs path-based or host-based routing.
Choosing ALB for network-heavy use cases that mainly need TCP or UDP performance.
Thinking one is always better instead of matching the balancer to the protocol layer.
Interview Tip
The short answer is: ALB is Layer 7 and smart for HTTP, NLB is Layer 4 and strong for raw network traffic.