Load Balancer
A load balancer distributes traffic across multiple backend instances, improving throughput and availability, at L4 (TCP) and L7 (HTTP) layers.
Purpose
Distribute traffic for throughput and availability, enabling horizontal scaling.
Mechanism
L4 (Nginx/HAProxy): distributes by TCP connection, fast but HTTP-unaware. L7: distributes by HTTP headers/URL/Cookies, supporting routing and session affinity. Algorithms: round robin/least connections/consistent hashing.
Use cases
- Traffic distribution
- Horizontal scaling
- High availability