Sub topic 11
Planned maintenance, partial outages, and what counts as down
This chapter assumes you know the nines notation, the difference between time-based and request-based measurement, and the definitions of SLI, SLO, and SLA from earlier chapters. The question here is which events count against your availability number. The arithmetic is simple. The hard part is agreeing on the definitions that feed it.
Planned maintenance
Planned maintenance is downtime you schedule in advance, such as a database upgrade or a schema migration that needs a restart. Users still cannot use the service during that time, so the question is whether it counts.
There are two common policies:
- Count it. The SLI treats every failed request the same, whatever the cause. This is the stricter and more honest view for users.
- Exclude it. The SLA or SLO names a maintenance window, often with advance notice, and failures inside that window are not counted.
Exclusion is common in contracts, because it lets the provider do necessary work without paying penalties. Internal SLOs usually count everything. If a maintenance window is excluded, the nines you quote describe only the time outside it. A service with a four-hour monthly window and a "99.99%" target may be unavailable for much longer than 4.32 minutes a month.
Zero-downtime techniques such as rolling deploys and blue-green releases shrink the window and make the question matter less. They are covered in the design patterns chapter.
Partial outages
Real failures are rarely all-or-nothing. A checkout page can fail while browsing works. One region can fail while the others serve traffic. A service can answer, but slowly.
Time-based measurement handles this badly. It needs a yes/no verdict for each minute, so you must pick a rule. Request-based measurement handles it naturally, because each request is judged on its own.
def request_availability(good, total):
return good / total
# Browsing works, checkout fails for one hour of a 30-day month.
browse = request_availability(9_900, 10_000)
checkout = request_availability(0, 100)
overall = request_availability(9_900 + 0, 10_000 + 100)
print(f"overall: {overall:.4%}")
print(f"checkout: {checkout:.1%}")The overall figure is about 98.02%, which hides the fact that checkout was fully down. Checkout is probably the most valuable request. Two fixes are common: define a separate SLI for each critical user journey, or weight requests by importance. Aggregated numbers can look healthy while one feature is broken.
What counts as down
Decide these edge cases before an incident, not during one.
| Situation | Typical decision |
|---|---|
| Server returns HTTP 500 | Failure |
| Server returns HTTP 404 for a missing page | Usually success, because the service worked correctly |
| Response takes 30 seconds | Failure if it exceeds the latency threshold in the SLI |
| Degraded mode, such as no recommendations | Often success, but only if the SLI says so |
| Failure caused by the client's own bad input | Not counted |
| Failure in a third-party dependency you rely on | Counted by users, and often counted in the SLI |
A good SLI definition is written down and states the measurement point. Measuring at a load balancer misses failures where requests never arrive, for example a DNS problem. Measuring from outside the network, with a probe or from client logs, catches more of them.
Common errors
- Quoting a nines figure without saying whether maintenance is included.
- Reporting one global percentage that hides a fully broken feature or region.
- Treating slow responses as successes because they eventually return a 200.
- Counting client-caused errors, which makes the SLI noisy and hides real faults.
Exercise
A service handles 1,000,000 requests in a month. During a planned maintenance window excluded by the SLA, 3,000 requests fail. Outside the window, 500 requests fail. What request-based availability do you report under the SLA definition, and what would users have experienced?
Show answer
Under the SLA, only the 500 failures count, so availability is (1,000,000 - 500) / 1,000,000 = 99.95%. Users experienced 3,500 failures, so (1,000,000 - 3,500) / 1,000,000 = 99.65%. The gap is the maintenance exclusion.