Lessons › From one user to millions
Survive a crash
Launch day: 10,500 requests per second. Machines die all the time. Any single one may crash, and once failover ends, users must not notice.
Play this levelFree with an account. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
Hardware fails. At scale it is not "if" but "when". Reliable systems assume any one machine can die and keep going (§10.2).
Redundancy means at least 2 of everything, so another copy takes over. The database gets a standby that is promoted if the primary dies. That typically takes 1–2 minutes, and writes fail until it's done.
A cache needs a spare too. If it dies, every read lands on the database at once. Losing 1 of 2 cache machines still loses half the keys, so make sure the database can carry the misses.
Capacity headroom (N+1) matters too: if 6 servers are just enough, losing 1 overloads the other 5. Keep one spare.
Try it: click any box and press "Crash one machine" to watch what happens, then repair it.
What you have to achieve
10,500 requests a second at the busiest hour, 10% of them writes.
- No broken or illegal connections
- Fewer than 0.1% of requests fail
- After any one machine crashes and failover ends, under 1% of requests fail
- p99 response time under 300 ms
- Machines cost at most $2,400 / month
What you learn
You designed for failure: no single point of failure and spare capacity. This is how real services stay up while machines die every day.
Check yourself
6 servers are just enough for your traffic. How many should you run?
- 6
- 7
- 12
Show the answer
7. N+1: keep one spare, so losing a machine doesn't overload the other five.
The primary database dies. What happens while the standby takes over?
- Nothing, it's instant
- Every request fails for an hour
- Writes fail for a minute or two
Show the answer
Writes fail for a minute or two. Promoting a standby typically takes 1–2 minutes. Reads from replicas and caches can carry on.