Sub topic 12
Availability targets and allowed downtime
This chapter assumes you know how to convert time units (seconds per day, days per year) and have a rough idea of what a load balancer and a replicated server do. You will turn an availability target into a downtime budget, and then use that budget to judge a design.
What an availability target means
Availability is the fraction of time a service works correctly. It is usually written as a percentage, and people name it by the number of nines: 99.9% is "three nines," and 99.99% is "four nines."
A percentage like this is hard to feel. Converting it to minutes of allowed downtime makes it concrete, and that is the estimate you make in a design discussion.
The conversion
Allowed downtime is the unavailable fraction multiplied by the length of the period.
minutes_per_year = 365 * 24 * 60
for availability in (99.9, 99.99):
downtime = (1 - availability / 100) * minutes_per_year
print(availability, round(downtime, 2))
# 99.9 525.6
# 99.99 52.56A year has 525,600 minutes. At 99.9%, the unavailable fraction is 0.001, which gives about 526 minutes, or 8.8 hours. At 99.99% it is about 53 minutes. Each extra nine cuts the allowed downtime by a factor of ten.
Common targets
| Availability | Downtime per year | Downtime per 30-day month |
|---|---|---|
| 99% | about 3.65 days | about 7.2 hours |
| 99.9% | about 8.8 hours | about 43 minutes |
| 99.99% | about 53 minutes | about 4.3 minutes |
| 99.999% | about 5.3 minutes | about 26 seconds |
A shortcut worth memorizing: 99.9% allows roughly 43 minutes per month, and every added nine divides that by ten.
Using the budget in a design
The budget limits what you can do operationally. At 99.99%, you have about 4.3 minutes per month. If a failed server takes 15 minutes to replace by hand, one failure breaks the target. That pushes you toward automatic failover and redundant servers, which connects to the server count from the previous chapter.
Redundancy also changes the math. If components are independent and any one of them can serve traffic, the system fails only when all of them fail. Two servers that are each 99% available give a combined availability of:
single = 0.99
replicas = 2
combined = 1 - (1 - single) ** replicas
print(combined) # 0.9999Two 99% servers in parallel reach about 99.99%. This is an upper bound, because the formula assumes failures are independent.
Components in a chain behave the other way. If a request must pass through a load balancer, an application server and a database, you multiply their availabilities. Three components at 99.9% each give about 99.7%, which is worse than any single one.
Common mistakes
- Mixing up the period. A "5 minutes of downtime" budget means very different things per month and per year. State the period.
- Ignoring planned maintenance. Some service agreements exclude it and some count it. Ask which applies.
- Treating the target as a promise of no outages. 99.99% allows one 50-minute outage per year. It does not prevent it.
- Forgetting dependencies. Your service cannot be more available than the product of the services it requires, unless you can work around their failures.
Exercise
A service must reach 99.95% availability. Roughly how many minutes of downtime are allowed per year, and does a single 30-minute outage fit in the budget?
Show answer
The unavailable fraction is 0.0005. Multiply by 525,600 minutes per year to get about 263 minutes. A single 30-minute outage fits, and you could afford about eight of them in a year.
Exercise
A request passes through a load balancer (99.99%), an application tier (99.95%) and a database (99.9%), all in series. What is the approximate combined availability?
Show answer
Multiply them: 0.9999 × 0.9995 × 0.999 ≈ 0.9984, or about 99.84%. The result is lower than the weakest component, and it allows about 14 hours of downtime per year.