Health checks and failover
40 min · Intermediate
A load balancer is only useful if it stops sending traffic to servers that cannot answer. Health checks tell it which servers to trust, and failover moves the work, or the balancer's own job, to a standby when something dies.
Topics in this lesson
- Liveness vs readiness
- A balancer that skips unhealthy servers
- Thresholds: fail after N, recover after M
- Failover for the balancer and the database
- Graceful shutdown: drain before removing
Key points
- Liveness = is the process working (restart if not); readiness = can it take traffic now (balancer skips it if not).
- A balancer skips servers marked unhealthy and returns 503 when none is healthy; detection takes a few check intervals.
- Fall and rise thresholds (for example 3 and 2) stop flapping; passive checks watch real errors too.
- Active-passive with a virtual IP removes the balancer as a single point of failure; graceful shutdown drains requests before a server leaves.
Interview questions this lesson answers
- What is the difference between liveness and readiness probes?
- How does a load balancer know a server is down?
- Why not mark a server down after one failed check?
- How do you avoid the load balancer being a single point of failure?
- What is graceful shutdown and why does it matter for deploys?
- What is split brain and how is it prevented?
Sign in to continue this lesson
Create an account to read every lesson, practise with the exercises and keep track of your progress.