Scalingchapter 2 of 4 · 4 lessons
Load Balancing
Distribute traffic across servers so no single machine is overwhelmed.
You bought the second server. Now a request arrives and something has to decide which of the two gets it.
That something is a load balancer, and it turns out to do four jobs rather than one. It spreads the traffic. It stops sending requests to a machine that has died. It lets you deploy by draining one machine at a time while the other carries the load. And it is usually where HTTPS ends.
It is the first distributed systems component most teams ever run, and it stays load-bearing forever after. It is also, from the day you install it, the thing that everything goes through.
Lessons
4 in this chapter- What a Load Balancer DoesOne address in front, many interchangeable servers behind, and failure handled per request.2 min
- Picking an AlgorithmRound robin balances request counts. The other algorithms exist because count is not load.6 min
- L4 vs L7L4 forwards connections it cannot read, fast. L7 reads the request and routes on it.3 min
- Health Checks and Failure HandlingDetection lag is interval times threshold, and a deep health check can eject your whole fleet.2 min