How Load Balancers Work
One address, many servers — and the user never notices.
A single server has a ceiling. A load balancer sits in front of a pool of servers, spreading incoming requests so no one machine is overwhelmed and any can fail without taking the site down.
Legend — how to read this diagram
How it decides where to send you
- Round robin. Rotate through servers in order — simple and even when requests are similar.
- Least connections. Send to whichever server is handling the fewest active requests.
- Hashing. Route by a key (like client IP) so a user keeps hitting the same backend.
- Health checks. Continuously probe servers; pull unhealthy ones out automatically.
Layer 4 vs Layer 7
L4. Balances by IP and port — fast, protocol-agnostic, no visibility into the request.
L7. Reads HTTP, so it can route by path or header, terminate TLS, and cache.
Sticky sessions. Pin a user to one server when state lives there, at the cost of even spread.
Put one smart doorway in front of many workers, and you get scale and fault tolerance for free.
No comments:
Post a Comment