Load balancer
In short: A load balancer distributes incoming requests across several servers so that none is overloaded and the service keeps running if one server fails.
In more detail: It regularly checks whether servers are healthy (health checks) and sends requests only to working ones. Methods include round robin, least connections and hash by client IP.
In Depth
- Layer 4 and 7: At layer 4 (TCP) it distributes connections; at layer 7 (HTTP) it decides by path, host or cookie.
- Sessions: “Sticky sessions” bind a user to one server. Better: store session data in a shared place.
- High availability: The balancer also needs redundancy.
- Examples: Nginx, HAProxy, cloud providers’ services.
See also: Nginx and reverse proxy, Scaling