Sub topic 9
Availability and reliability targets
This chapter assumes you know how to read short Python snippets and understand client-server systems. It also assumes you know the idea of a measurable target from the previous chapter (SLIs and SLOs).
Availability versus reliability
Availability is the share of time, or the share of requests, for which the system works when someone uses it. Reliability is the probability that the system keeps working correctly over a period. A service that returns errors for 5 minutes is unavailable. A service that answers every request but returns wrong data is available but not reliable.
A requirement should say which one it means, and how the system measures it.
Writing an availability target
Weak: "The service must be highly available."
Testable: "Redirects succeed for 99.9% of requests over a 30-day window." This names the SLI (the fraction of successful requests), the target (99.9%) and the window (30 days). It also says what counts as success. For example, a response with a 5xx status is a failure, and a 404 for a deleted link is not.
Turning a target into a downtime budget
The downtime budget is the time you may be down without breaking the target.
def downtime_budget_minutes(availability, days=30):
"""Minutes of allowed downtime for an availability target over a window."""
return (1 - availability) * days * 24 * 60
for target in (0.99, 0.999, 0.9999, 0.99999):
print(target, round(downtime_budget_minutes(target), 1))| Target | Budget per 30 days |
|---|---|
| 99% | 432.0 minutes |
| 99.9% | 43.2 minutes |
| 99.99% | 4.3 minutes |
| 99.999% | 0.4 minutes (about 26 seconds) |
Each extra nine cuts the budget to a tenth. At 99.99%, a single slow manual recovery can use the whole month's budget. Automated failover then becomes a requirement, not an option.
Dependencies change the math
Components that a request must pass through in sequence multiply their availabilities. Redundant components that can replace each other improve it.
def serial(*availabilities):
result = 1.0
for a in availabilities:
result *= a
return result
def parallel(a, replicas):
return 1 - (1 - a) ** replicas
print(round(serial(0.999, 0.999, 0.999), 5)) # 0.997 (load balancer, app, database)
print(round(parallel(0.99, 2), 5)) # 0.9999Three components at 99.9% each give only about 99.7% together. A target cannot exceed the availability of its critical dependencies unless you add redundancy or remove the dependency from the request path.
Reliability targets
Reliability requirements often use recovery measures:
- Recovery time objective (RTO): the longest acceptable time to restore service after a failure.
- Recovery point objective (RPO): the most data, measured in time, you accept losing.
For example: "RTO of 15 minutes and RPO of 0 for acknowledged writes." The RPO of 0 links to the durability requirement from the next chapters.
Exercise
A service has a 99.95% availability target over 30 days. How many minutes of downtime does it allow, and would a 30-minute outage break the target?
Show answer
(1 - 0.9995) 30 24 * 60 = 21.6 minutes. A 30-minute outage exceeds the budget, so the target is broken.