Load Balancer Choices
Load Balancer options include:
- Application Load Balancer (ALB) layer 7 - AWS
- Network Load Balancer (NLB) layer 4 - AWS
- Classic Load Balancer (CLB) - AWS
- Gateway Load Balancer (GLB) layer 3 - AWS
- Internal Load Balancer - Azure
- Public Load Balancer - Azure
- Application Gateway - available on Azure
- Cloud Load Balancing - GCP
- Global Load Balancing - GCPå
- HTTP(S) Load Balancing - available on GCP
- HAProxy - Third-party
- NGINX Plus - Third-party
- F5 BIG-IP - Third-party
- Traefik - open-source reverse proxy and load balancer.
Differences between AWS ALB and NLB
note: You can create a target group with a single ALB as the target, and configure your NLB to forward traffic to it.
- Layer of operation
- ALB is a layer 7 (application) load balancer, while
- NLB is a layer 4 (transport) load balancer.
- This means that ALB can perform content-based routing and SSL termination, while NLB operates at the transport layer and focuses on routing traffic based on IP protocol data.
- Supported protocols
- ALB supports HTTP/HTTPS protocols
- NLB supports TCP, UDP, and TLS.
- Target groups
- ALB uses target groups to route requests to registered targets. You can create target groups based on the HTTP/HTTPS request path, host, and query parameters, which helps to distribute traffic across multiple targets based on specific criteria.
- NLB routes traffic to IP addresses, taregt groups based on IP addresses, ports, and protocols.
- Health checks
- ALB health checks monitor the health of individual targets in target groups.
- NLB health checks monitor the health of the overall service.
- High availability
- ALB is designed to run in high availability mode with multiple Availability Zones,
- while NLB can run in a single Availability Zone.
- Performance
- ALB is optimized for small to medium traffic loads.
- NLB is designed for high performance and can handle millions of requests per second
- Cost
- ALB is less expensive than NLB, making it a more cost-effective choice for applications that do not require high performance or complex routing capabilities.
- Connection Handling
- AWS ALB supports both connection-based and content-based routing, which means it can route traffic based on the HTTP/HTTPS request header or the application-level content in the request.
- AWS NLB supports only connection-based routing, which means it can only route traffic based on the IP address, protocol, and port number.
- SSL/TLS Termination
- AWS ALB can terminate SSL/TLS connections at the load balancer and then send unencrypted traffic to the target groups. This reduces the load on the targets and provides additional security features.
- AWS NLB does not support SSL/TLS termination, so it cannot provide this feature.
- Cross-zone Load Balancing
- In ALB, cross-zone load balancing is enabled by default, which means that the load balancer can distribute traffic across all the registered targets in all the available zones.
- In NLB, cross-zone load balancing must be enabled manually, and it can only distribute traffic across the registered targets in the same zone as the load balancer.
- You can't disable Availability Zones for a Network Load Balancer after you create it, but you can enable additional Availability Zones.
Load Balancing Algorithms
- Round Robin *This algorithm simply distributes requests evenly among the available servers. It works well when all servers have similar capacity and response times.
- Least Connections *This algorithm directs traffic to the server with the fewest active connections. It works well when servers have varying capacities.
- IP Hash *This algorithm assigns requests based on the client's IP address. This ensures that a client is always directed to the same server. This can be useful for stateful applications.
- Random *This algorithm randomly selects a server to handle each request. It can be useful for applications with a large number of servers that have similar capacity and response times.
- WeightedThis algorithm assigns weights to servers based on their capacity, and directs traffic accordingly This can be useful for applications with servers of varying capacities.
- Least Time *This algorithm directs traffic to the server with the lowest response time. It can be useful for applications where response time is critical.