Distribution algorithms
- Round Robin — sends requests to each server in turn
- Least Connections — routes to the server with the fewest active connections
- IP Hash — a given client always goes to the same server (sticky sessions)
- Weighted — more powerful servers receive more requests
L4 vs L7
- L4 — TCP/UDP-level balancing; does not inspect the request body. Faster
- L7 — HTTP-aware; can route by URL, header, or cookie. Nginx, HAProxy, AWS ALB
Health Check
The load balancer periodically checks server health. If a server stops responding, it is removed from rotation until it recovers.