Day 54: Application load balencer Vs Network load balencer Vs Gateway load balencer in AWS

Vishesh GhuleVishesh Ghule
5 min read

🚀 Introduction

In AWS, load balancers are used to distribute incoming network traffic across multiple resources (such as instances, containers, or IP addresses) to ensure high availability and optimal performance. There are three main types of load balancers in AWS: Application Load Balancer (ALB), Network Load Balancer (NLB), and Gateway Load Balancer (GWLB). Each type serves different purposes and is suitable for different use cases. Let's explore the differences between them with real-world examples:


💎What is load balancing?

Application load balancer (ALB), network load balancer (NLB), and gateway load balancer (GLB) are three types of load balancers used in the cloud. Load balancing is the process of distributing network traffic equally across a pool of resources supporting an application. Modern applications process millions of users simultaneously. These high-traffic volumes require many resource servers with duplicate data. To redirect application traffic, ALBs examine the requested content, such as HTTP headers or SSL session IDs. NLBs examine IP addresses and other network information to redirect traffic optimally. GLBs act as a transparent network gateway (a single entry and exit point for all traffic) and distribute traffic while scaling your virtual appliances with the demand.


🔶 Application Load Balancer (ALB):

ALB operates at the application layer (Layer 7) of the OSI model and is best suited for routing HTTP/HTTPS traffic. It allows you to make intelligent routing decisions based on URL path, host headers, and HTTP methods. ALB supports content-based routing and can handle more advanced features like path-based routing and host-based routing.

Real-World Example: An e-commerce website that offers different services, such as shopping cart, user authentication, and product search, can use an ALB to route traffic to different backend services based on the URL path. For instance, incoming requests to /cart can be directed to a different set of instances than requests to /search.


🔶 Network Load Balancer (NLB):

NLB operates at the transport layer (Layer 4) of the OSI model and is designed to handle TCP, UDP, and TLS traffic. It is used for scenarios where high throughput and low latency are crucial, such as gaming or real-time communication applications. NLB provides a static IP address for the load balancer, making it suitable for applications that require clients to connect to a fixed IP.

Real-World Example: A gaming company running a multiplayer online game can use an NLB to distribute incoming traffic from players to game servers. NLB ensures low latency and high throughput, which are essential for delivering a smooth gaming experience.


🔶 Gateway Load Balancer (GWLB):

GWLB is a specialized load balancer that is used to route traffic from virtual appliances (such as firewalls, intrusion detection systems, or WAN optimizers) to your VPC resources. It operates at the network layer (Layer 3) and can work with Network Address Translation (NAT) devices as well.

Real-World Example: A company wants to enforce network security policies by routing all outgoing traffic from its VPC through a virtual firewall. The GWLB can be used to direct traffic from instances within the VPC to the virtual firewall instances, ensuring that all outbound traffic is inspected and controlled.


💎Comparison between ALB, NLB and GLB

🔸ALB (Application Load Balancer)

  • Operates at OSI layer 7 (application layer).

  • Routes traffic based on content examination (e.g., HTTP headers or SSL session IDs).

  • Distributes traffic across multiple targets (e.g., EC2 instances) for specific application functions.

  • Terminates and establishes new connections acting as a proxy.

  • Supports protocols like HTTP, HTTPS, and gRPC.

  • Uses a round-robin algorithm for traffic distribution.

  • Ideal for microservices, containerized environments, and web applications.

🔸NLB (Network Load Balancer)

  • Operates at layer 4 (transport layer).

  • Routes traffic based on network conditions, using predetermined server IP addresses or availability.

  • Monitors target health and routes traffic only to healthy targets.

  • Terminates and establishes new connections acting as a proxy.

  • Supports protocols like TCP, UDP, and TLS.

  • Uses a flow hash algorithm for traffic distribution.

  • Suitable for high-performance, low-latency, and scalable network-level balancing, commonly used in gaming systems, media streaming, and IoT applications.

🔸GLB (Gateway Load Balancer)

  • Operates across layers 3 (network layer) and 7 (application layer).

  • Acts as a transparent network gateway, providing a single entry and exit point for all traffic.

  • Scales virtual appliances (e.g., intrusion detection, firewalls) based on demand.

  • Does not act as a proxy and does not terminate connections; forwards traffic directly.

  • Supports IP-based routing and uses routing table look-ups.

  • Suitable for balancing on the network gateway level, managing traffic between cloud and on-premises environments, and across different regions.


💎Main Differences

🔸OSI Layer:

  • ALB: Layer 7

  • NLB: Layer 4

  • GLB: Layers 3 and 7

🔸Target Types:

  • ALB: IP, instance, and lambda

  • NLB: IP, instance, and ALB

  • GLB: IP and instance

🔸Proxy Behavior:

  • ALB and NLB: Terminates connections

  • GLB: Doesn’t terminate the flow

🔸Protocols:

  • ALB: HTTP, HTTPS, gRPC

  • NLB: TCP, UDP, TLS

  • GLB: IP-based routing

🔸Algorithms:

  • ALB: Round-robin

  • NLB: Flow hash

  • GLB: Routing table lookup

  • OSI Layer:

  • ALB: Layer 7

  • NLB: Layer 4

  • GLB: Layers 3 and 7

🔸Target Types:

  • ALB: IP, instance, and lambda

  • NLB: IP, instance, and ALB

  • GLB: IP and instance

🔸Proxy Behavior:

  • ALB and NLB: Terminates connections

  • GLB: Doesn’t terminate the flow

🔸Protocols:

  • ALB: HTTP, HTTPS, gRPC

  • NLB: TCP, UDP, TLS

  • GLB: IP-based routing

🔸Algorithms:

  • ALB: Round-robin

  • NLB: Flow hash

  • GLB: Routing table lookup


🚀Conclusion

ALB is suitable for routing HTTP/HTTPS traffic and provides advanced routing capabilities based on content.
NLB is ideal for high-throughput, low-latency scenarios that involve TCP, UDP, or TLS traffic.
GWLB is used to route traffic to virtual appliances for network security and other purposes.
Choose the type of load balancer that aligns with your specific application requirements and architecture to achieve the desired performance, availability, and functionality.


Thanks for reading to the end; I hope you gained some knowledge.❤️🙌

Linkedln

Twitter

Github

0
Subscribe to my newsletter

Read articles from Vishesh Ghule directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vishesh Ghule
Vishesh Ghule

I'm proficient in a variety of DevOps technologies, including AWS, Linux, Python, Docker, Git/Github, Shell Scripting, Jenkins and Computer Networking. My greatest strength is the ability to learn new things because I believe there is always room for self-development