Short answer
A load balancer spreads incoming requests across multiple servers to increase capacity and availability. It routes with algorithms such as round robin, least connections or hashing, removes unhealthy servers using health checks, and can work at layer 4 (TCP) or layer 7 (HTTP), where it can also route by path, header or cookie.
Design points
- Health checks and connection draining for safe deployments.
- Sticky sessions only when state cannot be externalised.
- TLS termination at the load balancer versus end-to-end encryption.
- Redundant load balancers to avoid a single point of failure.
How to answer it in an interview
- Contrast L4 and L7 in one sentence each.
- Mention global load balancing with DNS or anycast for multi-region setups.