Lesson 1 · Unit 03
Load balancing
Spread requests, skip dead servers, keep servers stateless
What you practise
- Round robin, least connections, hashing
- Health checks
- Layer 4 vs layer 7
- Sticky sessions and why stateless servers are easier
- Autoscaling
Try a question from this lesson
Pick one
Three identical servers sit behind one address. Requests arrive one at a time and all cost about the same. What is the simplest fair way to hand them out?
Correct answer
Take turns: 1, 2, 3, 1, 2, 3
Why
Taking turns is called round robin. It needs no knowledge of the servers and gives each an equal share, which is all you need when the servers and the requests are alike.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Health checks
A load balancer keeps asking each server a cheap question, such as GET /health. A server that fails several checks in a row is taken out of rotation, and put back when it passes again.
This is what turns "a server died" from an outage into a non-event. It only works if the remaining servers have room for the extra load.
LB -- GET /health --> s1 200 OK
LB -- GET /health --> s2 timeout
LB -- GET /health --> s2 timeout
LB -- GET /health --> s2 timeout
=> s2 leaves the rotation11 more exercises in the app
- 3× type the answer
- 5× multiple choice
- 1× match the pairs
- 1× true or false
- 1× fill the blanks
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.