Home/Glossary/Load Balancer

Load Balancer

A system that distributes incoming network traffic across multiple servers to ensure high availability, reliability, and optimal resource utilization.

Cloud InfrastructureAlso called: "lb", "traffic distribution", "server load balancing"

Load balancers are critical infrastructure components that prevent server overload, eliminate single points of failure, and enable horizontal scaling.

Why it matters

  • Ensures application availability even when individual servers fail.
  • Enables horizontal scaling by adding servers behind the load balancer.
  • Improves response times by routing requests to the least-busy server.
  • Required for high-availability architectures and disaster recovery.
  • Essential for meeting SLA commitments for uptime and performance.

Load balancing algorithms

  • Round Robin: Distributes requests sequentially across servers.
  • Least Connections: Routes to the server with fewest active connections.
  • Weighted: Assigns proportional traffic based on server capacity.
  • IP Hash: Routes requests from the same client IP to the same server (session persistence).
  • Least Response Time: Chooses the server with fastest response and fewest connections.

Types of load balancers

  • Layer 4 (Transport): Routes based on IP address and TCP/UDP port; fast but less flexible.
  • Layer 7 (Application): Routes based on HTTP content (URL, headers, cookies); more intelligent but higher overhead.
  • Global (GSLB): Distributes traffic across geographically distributed data centers.
  • Internal: Balances traffic between services within a private network.

Health checks

  • Active checks: Load balancer periodically probes servers for availability.
  • Passive checks: Monitors actual traffic for errors and response times.
  • Graceful degradation: Remove unhealthy servers from rotation without dropping connections.

High availability patterns

  • Active-Passive: Standby load balancer takes over if primary fails.
  • Active-Active: Multiple load balancers share traffic with automatic failover.
  • DNS failover: GSLB redirects traffic to healthy data centers.

Cloud implementations

  • AWS: Application Load Balancer (ALB), Network Load Balancer (NLB), Classic Load Balancer.
  • Azure: Azure Load Balancer, Application Gateway.
  • GCP: Cloud Load Balancing (HTTP(S), TCP/UDP, Internal).