Skip to content

Types of Load Balancer

Types of Load Balancers

1. Layer 4 Load Balancer (Transport Layer)

  • Operates on TCP/UDP by analyzing basic information like IP addresses, ports,.
  • Routing traffic based on network-level data without inspecting the content of the actual data.
  • Faster (ideal for high vollume traffic), but less flexible (limited feature).
  • Less expensive
  • Example: AWS NLB, HAProxy in TCP mode.

2. Layer 7 Load Balancer (Application Layer)

  • Works with HTTP/HTTPS.
  • Can inspect content (URL, headers, cookies).
  • Routing decisions based on application-specific data like the content of the data packets, HTTP headers, URLs and cookies etc.
  • Slightly slower processing due to content inspection, but more flexible (used for routing rules, caching, SSL termination, etc.).
  • More expensive because of many features & processing power.
  • Example: NGINX, AWS ALB, Traefik.

Summary of L4 & L7:

Following is the use case for L4 & L7 load balancers.

Use CaseProtocolLB LayerReason
Online Multiplayer GamesUDPL4Fast routing, no payload inspection
Video StreamingTCP/UDPL4Lower latency, protocol-based routing
Chat/WebSocket AppsTCPL4Long-lived TCP connections
Web APIs / Web AppsHTTP(S)L7Route by path, header, method
SaaS with subdomainsHTTP(S)L7Host-based routing
A/B Testing / Canary DeploysHTTP(S)L7Cookie-based or header-based decisions
VPN ServicesUDP/TCPL4Encryption makes app-layer routing hard