zaro

What are the 4 Types of Load Balancers?

Published in Load Balancer Types 4 mins read

Load balancers are essential components in modern computing infrastructures, distributing incoming network traffic across a group of backend servers to ensure high availability, scalability, and performance. While implementations can vary between cloud providers and on-premise solutions, load balancers are generally categorized into four primary types based on their operational layer and functionality: Application Load Balancers, Network Load Balancers, Global Server Load Balancers, and DNS Load Balancers.

1. Application Load Balancers (Layer 7)

Application Load Balancers (ALBs) operate at Layer 7 of the OSI model (the application layer). This means they understand the content of the traffic, such as HTTP and HTTPS requests. Their ability to inspect traffic at this level allows for advanced routing decisions based on URL paths, host headers, query strings, and even cookies. This makes them ideal for microservices architectures and web applications that require intelligent routing.

  • Traffic Type: Primarily HTTP or HTTPS.

Application Load Balancers can perform SSL offloading, sticky sessions, and content-based routing, directing requests to specific backend services based on the application protocol. For instance, requests for images can be routed to one set of servers, while requests for video streams go to another.

2. Network Load Balancers (Layer 4)

Network Load Balancers (NLBs) operate at Layer 4 of the OSI model (the transport layer). They forward traffic based on IP addresses and port numbers, without inspecting the content of the packets. This makes them extremely fast and efficient for handling high-throughput, low-latency traffic. Network Load Balancers are often preferred for non-HTTP/HTTPS protocols and scenarios where raw performance is paramount. Within this category, there are typically two common sub-types:

  • Passthrough Network Load Balancers: These balancers directly forward client connections to backend instances. The backend instances then send responses directly to the client, bypassing the load balancer on the return path. This "direct server return" model can improve performance for certain workloads.
    • Traffic Type: TCP or UDP. These load balancers also support other IP protocol traffic such as ESP, GRE, ICMP, and ICMPv6.
  • Proxy Network Load Balancers: Unlike passthrough balancers, proxy network load balancers terminate the client connection and establish a new connection to the backend server. This allows for features like SSL offload (even for TCP traffic), connection draining, and advanced health checks.
    • Traffic Type: TCP with optional SSL offload.

3. Global Server Load Balancers (GSLB)

Global Server Load Balancers (GSLB) are designed to distribute traffic across geographically dispersed data centers or cloud regions. They operate at the DNS level, directing user requests to the closest or best-performing data center based on factors like latency, server load, and geographic location. GSLBs are crucial for disaster recovery, ensuring business continuity by rerouting traffic away from failed regions, and for improving user experience by connecting users to the nearest available resources.

  • Key Functionality: Geographic traffic distribution, disaster recovery, improved latency for global users.
  • Use Cases: Multi-region deployments, global applications.

4. DNS Load Balancers

DNS Load Balancers utilize the Domain Name System (DNS) to distribute traffic. When a client requests to resolve a domain name, the DNS server is configured to return multiple IP addresses for that domain. The client then typically selects one of these IP addresses, often round-robin. While simple to implement and cost-effective, DNS load balancing lacks the sophistication of other load balancer types as it cannot factor in server health or current load in real-time. It relies on the client's DNS resolver for distribution.

  • Key Functionality: Distributes requests by rotating IP addresses in DNS responses.
  • Limitations: Lacks real-time server health checks, client-side caching can lead to uneven distribution.

Comparison Table of Load Balancer Types

Load Balancer Type OSI Layer Primary Traffic Types Key Capabilities & Use Cases
Application Load Balancer Layer 7 HTTP, HTTPS Content-based routing, SSL termination, sticky sessions, microservices.
Network Load Balancer Layer 4 TCP, UDP, ESP, GRE, ICMP, ICMPv6 High performance, low latency, raw TCP/UDP forwarding, direct server return (passthrough), TCP proxying with SSL offload.
Global Server Load Balancer DNS Any protocol (indirect via DNS) Geo-distribution, disaster recovery, global application resilience.
DNS Load Balancer DNS Any protocol (indirect via DNS) Simple traffic distribution, often for basic redundancy; lacks real-time awareness.