Load Balancing
Adding servers helps only if requests reach them all, and the way they are placed matters as much as how many there are. At 80% utilisation, four servers with a queue each answer in 100 ms while the same four sharing one queue answer in 34.9 ms. A load balancer is the part that decides, request by request, where each one goes, and it has to do so with what it can see, which is never the whole truth. This module shows what it can see, what it chooses with, how it learns that a server is gone, and what it costs to keep a client on one server or to take a server out.
You will compare four algorithms on the same requests, slow a server down and watch two of them fail, make a server die and count what the delay in noticing it costs, pin clients to servers and watch the balance go, move keys on a ring, and replace a server with and without draining it. Every lesson has a “what happens if” moment.
The lessons
Section titled “The lessons”- What a load balancer does (15 min). One address in front of many servers, what a balancer sees at layer 4 and at layer 7, and where global balancing starts.
- Balancing algorithms (22 min). Round robin, random, least connections and two random choices on the same requests, and what a slow server does to each.
- Health checks (23 min). How a balancer learns that a server is down, what the delay costs, and why a check cannot create capacity.
- Sticky sessions (18 min). What pinning a client to a server costs in balance, in failures and after a deploy.
- Consistent hashing (20 min). Why hash mod N reshuffles most keys, how a ring moves about 1/N of them, and what a ring does not balance.
- Connection draining (18 min). Taking a server out without cutting its requests, and what each step saves.
- Recap and quiz (12 min). The module in one page, a checklist for a balancing design, and a quiz.
What you will be able to do
Section titled “What you will be able to do”- Say what a balancer can see at layer 4 and at layer 7, and choose the layer for a requirement.
- Pick an algorithm for traffic and servers, and say what each one needs to know and where it fails.
- Compute how long a balancer takes to remove a dead server, and the requests lost in that time.
- Say what sticky sessions and consistent hashing give up, and what to do instead.
- Take a server out for a deploy without cutting requests, and say what that still needs.
All the numbers in the labs and calculators are illustrative. They are for comparing choices, not for forecasting any real product.
Built by GhaziAlibi.
© ShardCraft. All rights reserved.