System Design · 05. Reliability · 10 min · Intermediate
Redundancy & Failover
Keep spare copies, and switch to them fast when a part dies.
In short
Remove every single point of failure: two of each part, health checks to find the dead one, and copies in separate zones (and, if worth it, regions). One chain at 97.03% became 100% on paper.
Failover costs seconds, and copies can fail together, so test failovers on purpose before a real failure does it for you.
Key ideas
- Do not ask "will it fail?" Ask "what happens to users when it does?" (step 1)
- A good health check tests what matters (can it reach its database?), not only that the process is running. (step 5)
- Choose the target from the business need. Each extra nine costs far more than the one before. (step 9)
Good to know
- Active-passive is simple and safe for data that must have one writer, such as a database. (step 3)
- Spreading over zones is cheap with cloud providers and is the usual first step for high uptime. (step 7)
Watch out
- Look for SPOFs by asking of each box: if this one dies right now, does the whole system stop? (step 2)
- Two servers at 70% load each cannot survive a failure: the one left would need 140%. Keep each below 50%, or add a third. (step 4)
- Faster checks find failures sooner but remove healthy servers by mistake. Tune the speed against false alarms. (step 6)
- Most systems stop at two zones. Add regions only when an outage would cost more than running a second region. (step 8)
Key numbers
- Uptime
- 99.9996%
- Downtime / year
- 2.0 min
Terms
- Single point of failure
- A part with no spare, whose failure stops the whole system.
- Redundancy
- Keeping more than one copy of a part so one can fail without an outage.
- Active-passive
- One copy serves traffic while a standby waits to be promoted if it dies.
- Active-active
- All copies serve traffic at the same time, and the survivors take over when one fails.
- Health check
- A regular probe, such as GET /health, that tells a load balancer whether a server can take traffic.
- Failover
- Switching traffic from a failed part to its spare, which takes seconds.
- Availability zone
- A separate building in a region with its own power and network.
- Region
- A group of zones in one area; a second region protects against a whole-region outage.
- Nines of uptime
- Uptime written as 99.9%, 99.99% and so on; each extra nine cuts allowed downtime by ten times.