ALB vs NLB vs GLB: What to use?

If you are deploying your application in the cloud environment, you must have come across a concept called Load Balancers.

But what is a Load Balancing?

Load balancing is distributing network traffic equally across a pool of resources supporting an application. It helps keep your application fast, reliable, and always available.

If you deploy your application on AWS and want it to be highly available, you’ll probably need a load balancer to distribute traffic to your server targets. When you create a load balancer in AWS, you might see a screen showing three different types of load balancers. But which one should you choose?

Application Load Balancer:

Application load balancer (ALB) works at the application layer (OSI Layer 7) and helps in managing web traffic, making it a good choice for modern apps, microservices, and containerized environments.

ALB has some features that can help in routing traffic requests based on specific rules like origin URL path, hostname, query parameters, and HTTP headers, ensuring each request reaches the right backend service.

ALB has a component called listener which is used to specify which traffic to be routed to which target group based on the listener rules.

Image ref: AWS Docs

Network Load Balancer:

Network Load Balancer (NLB) works at the transport layer (OSI Layer 4) and is designed to handle high-performance traffic with ultra-low latencies.

NLB has support for TCP and UDP, ensuring efficient routing of connection-level requests like database queries, streaming, or gaming applications. NLB also preserves the client-side source IP allowing the back-end to see the IP address of the client. This can then be used by applications for further processing.

Network Load Balancer automatically provides a static IP per Availability Zone (subnet) that can be used by applications as an endpoint.

Gateway Load Balancer:

Gateway Load Balancer (GLB) works at OSI Layer 3 and combines the functionality of a network gateway with a load balancer, simplifying traffic management for virtual appliances.

GLB works seamlessly with third-party virtual appliances like firewalls and intrusion detection systems, helping scale and manage them easily without changing their configurations

When to Use: ALB vs. NLB vs. GLB

Choose ALB when you need application-level traffic management and routing. It’s ideal for microservices, containerized environments, and web applications.

NLB is best for high-performance, low-latency, and scalable network-level balancing. Applications that distribute traffic at the transport layer use NLBs, such as gaming systems, media streaming services, and large IoT systems.

GLB is perfect for balancing at the network gateway level. For instance, GLB is effective if you manage traffic between cloud and on-premises environments or across different regions. It combines OSI layers 3 and 4 balancing, allowing it to route traffic between various regions and networks. With IP-based routing, it can distribute traffic across virtual gateways, providing high scalability and availability

Note: While Classic Load Balancer (CLB) is an option AWS provides, that is not discussed in this post and also it is not recommended to use CLB.

Did you find this article valuable?

Support Srinivas Karnati by becoming a sponsor. Any amount is appreciated!