Back to blog

The server dies at 3am: who notices, and who takes over?

Thắng Đoàn
Thắng Đoàn

FotoFlow's stack is a load balancer, two app servers and a database, and each part is up 99.9% of the time. At 3am the app server dies, the health checks fail, and the load balancer quietly stops sending traffic to it. The other server carries on. Nobody wakes up. That story only exists because of what the stack looked like a year earlier, when one box was all there was.

Nines multiply down

One of everything sounds solid until you chain them. A request needs every component working, so their availabilities multiply. Three components at 99.9% each give 0.999 to the power of three, about 99.7%: 26 hours of downtime a year from parts that are each "almost always up."

A single point of failure is anything whose failure alone takes the system down. In the one-box stack, that was every component: a bad disk, a kernel panic, a botched deploy, and 300,000 users see an error page.

Two of everything, apart

Add a spare for each part: load balancers in an active-passive pair, app servers sharing traffic, a database follower ready to take over. Both copies must now fail at once for an outage, and failure chances in parallel multiply downward fast.

But copies only help if they fail separately. Two spares in one data centre die together in one power outage. These are correlated failures, and the fix is spreading across availability zones: separate buildings, kilometres apart, own power and network. The same idea scales up: racks, zones, and for the most critical systems, whole regions.

When zone A goes dark, health checks fail it out and the follower in zone B is promoted. Users mid-request retry; within a minute everything runs from zone B. Redundancy you cannot afford to run on is not redundancy: zone B must carry 100% of traffic alone, not 51%.

Failover itself has two numbers worth agreeing with the business first: RTO, how long until service returns, and RPO, how much recent data may be lost. Async replication makes the follower a few seconds behind, and those writes are gone; synchronous gets RPO to zero at the cost of slower writes.

The outage you cause yourself

Hardware is not the usual killer. A release with a bug goes to every app server in both zones at once, and every copy crashes on the same request. Identical copies fail identically. A bad change is a correlated failure you inflict on yourself. Most real outages are changes: code, config, infrastructure.

So deploys roll out in stages. A canary release puts v2.4 on one server or 1% of traffic and watches its error rate and latency against the rest. Worse means roll back with 1% of users briefly affected; fine means 10%, 50%, 100%. Feature flags go further: ship the code dark, turn it on gradually, off instantly.

Untested failover is the quieter lie. A failover path that never runs rots: a config drifts, a spare is too small, a script has a typo, and you find out during the real outage. Teams break things on purpose in production, in working hours: chaos engineering. Netflix's Chaos Monkey kills servers daily; start with a planned game day, one failure at a time.

What this does not solve

Multi-region is the ceiling of this idea, and most systems should not buy it. Two regions with a global front door send each user to the nearest healthy one, but data across an ocean replicates with about 100 ms of lag, and the complexity is a full-time job. Multiple zones in one region plus good backups serve most products honestly.

Every component is 99.9% available and your site is down 26 hours a year. Which chain multiplied?
Your failover has never run. What has quietly drifted since the day it was configured?

One dead server is now a non-event. Next in the series: One user uploads 10,000 photos a minute: where do you draw the line?

Sources

Google SRE Book

System Design Primer

Netflix Technology Blog

Share:

Recommended for you

Enjoyed this article?

Subscribe for new articles. No spam. Unsubscribe anytime.

No pasting. This is the challenge.0/200

Typed live, never pasted.