Load balancer
Load balancer
Gold
A load balancer spreads incoming requests across several servers and routes around unhealthy ones, so capacity can grow by adding machines.
- Use when
- Two or more interchangeable servers · Rolling deploys and failover
- Avoid when
- A single server with no need for redundancy yet · Servers that keep per-user state, unless sessions move elsewhere
- Trade-offs
- One extra hop of latency · Layer 4 (fast, simple) vs layer 7 (routes by path or header) · Managed service cost vs running your own proxy
- Requires
- Server capacity & scaling up
3 objectives · 8 misconceptions
- predict Predict per-server load when a load balancer fronts N servers.
- explain Explain how health checks take failed servers out of rotation.
- choose Choose between round-robin and least-connections when requests vary in cost.
- Not true: Adding a load balancer by itself adds capacity.
- Not true: The load balancer cannot be a single point of failure.
- Not true: A load balancer fills one server before it uses the next.
- Not true: A load balancer stops sending traffic to a dead server the moment it dies.
- Not true: Sending every server the same number of requests balances the load.
- Not true: Least-connections is always the better algorithm.
- Not true: A load balancer's health checks fix or restart failed servers.
- Not true: When one server behind a load balancer dies, the whole site goes down.
Learn
Load balancerFree with an account~10 minPractice
Launch dayFree with an accountmediumCheck
Station test-out80% to passStories here
Neighborhood
builds onServer capacity & scaling up
→Load balancer→