Count the nines
Sales wants to promise customers 99.9% uptime, which people call three nines. Your design has one load balancer, one cache machine and one database machine. Work out what you can really promise.
Play this levelPart of Bugpit Pro. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
Availability is the share of the time a system answers. 99.9% sounds close to 100%, but it allows almost 9 hours of downtime a year. Each extra nine cuts that by ten, so 99.99% is under an hour.
Parts in a chain multiply. A request needs the load balancer and the servers and the database, so three parts at 99.5% each give 0.995 × 0.995 × 0.995, about 98.5%. The more parts in the chain, the lower the number.
Spares work the other way. Two machines doing the same job are only down when both are down: 0.5% × 0.5% is 0.0025% of the time. That's why one spare takes a part from two nines to four.
An SLO is the target you set yourself, such as 99.9%. The gap to 100% is your error budget: the downtime you're allowed. Spend it on releases and experiments, and slow down when it runs out. An SLA is the promise in a contract, with money attached, so it's set lower than the SLO.
This simulator assumes each machine is up 99.5% of the time, which is the level AWS's own agreement for a single server commits to, and that machines fail independently. Real outages often take several machines at once, so treat the result as the best case. It also counts every part a request touches as required, including the cache.
What you have to achieve
4,000 requests a second at the busiest hour, 5% of them writes.
- No broken or illegal connections
- The design is up at least 99.90% of the time
- No component is overloaded
- Fewer than 0.1% of requests fail
- p99 response time under 250 ms
What you learn
Every part on the path now has a spare, and the sums say about four nines. Add up the chain before you promise a number, and remember that every new service a request passes through is one more thing to multiply by.
Check yourself
A service is up 99.9% of the time. About how long is it down in a year?
- About 9 minutes
- About 9 hours
- About 9 days
Show the answer
About 9 hours. A year has 8,760 hours, and 0.1% of that is 8.76 hours.
A request passes through two services, and each is up 99.9% of the time. How often are both up?
- 99.9%
- About 99.8%
- 99.99%
Show the answer
About 99.8%. Parts in a chain multiply: 0.999 × 0.999 is about 0.998. Every extra hop lowers it.
One machine is up 99% of the time. You run two, and either can do the job. How often is at least one up?
- 99%
- 99.5%
- 99.99%
Show the answer
99.99%. Both are down together 1% × 1% of the time, which is 0.01%. So at least one is up 99.99%.
Your target is 99.9%, and this month's downtime has already used the whole error budget. What should the team do?
- Ship the big release anyway
- Pause risky releases and work on reliability
- Quietly lower the target
Show the answer
Pause risky releases and work on reliability. The budget is how much risk you can take. When it's spent, you stop spending until it refills.