Availability is the fraction of time, or of requests, that the system works. It's usually written in "nines", and each extra nine cuts the allowed downtime by a factor of ten.
| Availability | Downtime per year | Per month |
|---|---|---|
| 99% (two nines) | 3.65 days | 7.3 hours |
| 99.9% (three nines) | 8.77 hours | 43.8 minutes |
| 99.95% | 4.38 hours | 21.9 minutes |
| 99.99% (four nines) | 52.6 minutes | 4.4 minutes |
| 99.999% (five nines) | 5.26 minutes | 26 seconds |
At four nines there isn't time for a person to notice, log in and fix anything. Recovery has to be automatic.
Series and parallel
When a request needs several components in a chain, their availabilities multiply, and the chain is weaker than any single link:
Redundancy is the parallel formula at work: two mediocre components in parallel beat one excellent one. The catch is the word independent. Two servers in the same rack, on the same power supply, running the same buggy deploy, fail together.
Remove single points of failure
Go through the diagram box by box and ask: what happens when this one dies?
- Stateless tiers: run N+1 (or N+2) instances behind a load balancer with health checks. Losing one costs capacity, not availability.
- Stateful tiers: keep a replica or standby that can be promoted. See replication.
- The load balancer, DNS, config and secrets services: these are easy to forget, and they're single points of failure too.
- The data centre: spread across availability zones. For the highest targets, spread across regions.
Active-passive vs active-active
Active-passive keeps a standby idle until it's needed. It's simpler, but failover takes time and the standby might not work when you finally use it. Active-active serves traffic from every copy all the time, so you know every copy works, and failure only means redistributing load. You have to keep enough headroom that the survivors can carry the whole load.
RTO and RPO
RTO (recovery time objective) is how long recovery may take. RPO (recovery point objective) is how much data you can afford to lose. A nightly backup gives you an RPO of 24 hours. Async replication gives seconds. Synchronous replication gives zero, at the cost of slower writes.
Stop failures from spreading
- Timeouts on every network call. A call with no timeout ties up a thread forever when the other side hangs.
- Retries with backoff and jitter, only for idempotent operations, and with a retry budget. Unlimited retries turn a slow service into a dead one.
- Circuit breakers: after repeated failures, stop calling a dependency for a while and fail fast instead.
- Bulkheads: separate thread or connection pools per dependency, so one slow dependency can't use them all up.
- Graceful degradation: if the recommendations service is down, show the page without recommendations.
Practise failing
Failover paths that never run tend to be broken when you need them. Chaos engineering kills instances, adds latency and cuts off zones on purpose, in a controlled way, to prove recovery works. That's what the Four Nines level does to your design.
In the game: APP 1 crashes from 18 s to 34 s and the database primary dies from 38 s to 50 s. To stay under 0.5% errors, the remaining app servers must carry peak traffic (N+1), and a replica must be there to promote.
Interview checklist
- State an availability target and translate it into downtime.
- Walk every component and say what happens when it fails.
- Run N+1 for stateless tiers and replicas with failover for stateful ones.
- Give RTO and RPO numbers.
- Add timeouts, retries with backoff and circuit breakers so failures don't spread.
Level 11: Four Nines
Put this into practice against live traffic. Your progress in the game is saved in your browser.
Play level 11Further reading
- Martin Kleppmann, Designing Data-Intensive Applications (O'Reilly). The standard book on replication, partitioning and consistency.
- Site Reliability Engineering, Google's free book on running reliable systems.
- The Amazon Builders' Library: practical articles on timeouts, retries, caching and load shedding.
- The System Design Primer: a broad, community-maintained overview.