AWS Under the Hood — Day 12 — Choosing Between AWS Load Balancers: ALB vs. NLB — Features, Use Cases and Technical Considerations

Prashant Lakhera
3 min readMay 7, 2024

Choosing between AWS Application Load Balancer (ALB) and Network Load Balancer (NLB) depends on the specific requirements of your application’s architecture, traffic patterns, and the protocols used. Both types of load balancers serve to distribute traffic across multiple targets, but they operate at different layers of the OSI model and offer different features. Here’s a detailed comparison and an explanation of how each works:

AWS Application Load Balancer (ALB)

Layer 7 Load Balancing: ALB operates at the OSI model’s application layer (Layer 7). It can make routing decisions based on the content of the HTTP/HTTPS headers, URL paths, query strings, and more.

  • Features:Content-Based Routing: ALB allows you to route traffic based on request content, making it ideal for modern application architectures, including microservices and container-based applications.
  • Host and Path-Based Routing: You can route traffic based on the domain name (host) or the URL path specified in the request.Support for HTTP/2 and WebSocket: It supports advanced web protocols, which are beneficial for improving performance and real-time communication.
  • Integration with AWS Services: ALB integrates well with other AWS services, such as ECS (Elastic Container Service), EKS (Elastic Kubernetes Service), and AWS WAF (Web Application Firewall).

Use Cases:

  • Applications that need intelligent routing based on content.Microservices architecture where different services are served at different paths or hostnames.Web applications requiring WebSocket or HTTP/2 capabilities.

AWS Network Load Balancer (NLB)

Layer 4 Load Balancing: NLB operates at the transport layer (Layer 4). It routes traffic based on IP protocol data, such as TCP port and IP address.

  • Features:High Performance and Low Latency: NLB is optimized to handle millions of requests per second while maintaining low latencies.
  • Static IP or Elastic IP: Unlike ALB, NLB allows the assignment of a static IP per Availability Zone or the use of Elastic IP addresses.
  • Direct TCP and UDP Traffic Routing: Supports routing of TCP and UDP traffic, making it suitable for applications that require direct connection to the load balancer.
  • Zonal Isolation: Traffic is isolated by an Availability Zone, which can enhance fault tolerance.

Use Cases:

  • Applications that require high performance and low latency.TCP or UDP-based applications, such as gaming servers or stock trading platforms.Situations where a static or elastic IP address is necessary for whitelisting in firewalls.

Choosing Between ALB and NLB

  • Protocol and Routing Requirements: If your application requires complex routing based on the content of the HTTP/HTTPS headers or needs WebSocket support, choose ALB. If your application primarily uses TCP or UDP and benefits from low latency and high throughput, go with NLB.
  • Performance Considerations: For ultra-high performance and low latency requirements, NLB is typically more suitable because of its ability to handle volatile high traffic patterns and its operational efficiency at the TCP level.
  • IP Address Needs: If having a static IP is crucial for your application deployment, NLB would be the better choice.
  • Integration and Features: Consider the additional features like WAF integration or the need for detailed routing rules, which might lean towards choosing ALB.

🏁 Understanding these under-the-hood mechanics and features can help you better decide which load balancer best meets your application’s needs.

📚 If you’re interested in more in-depth explanation of these topics, please check out my new book “Cracking the DevOps Interview”

📚 To learn more about AWS, check out my book “AWS for System Administrators”



Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP