Sub topic 7
Error Budgets in Practice
This chapter assumes you know what an SLI and an SLO are (covered in the previous chapter), can convert nines into downtime, and can read short Python snippets. Here you turn an SLO into a budget and use that budget to make decisions.
What an error budget is
An error budget is the amount of unreliability your SLO allows. If the SLO is 99.9%, then 0.1% of requests (or of time) may fail without breaking the target. That 0.1% is the budget.
The budget turns an abstract target into a number you can spend. A deploy that causes errors spends budget. An outage spends budget. A slow rollback spends budget. When the budget is gone, you have used up all the unreliability you promised yourself you could afford.
Computing a request-based budget
For a request-based SLI, the budget is the number of failures the SLO permits over the window, minus the failures that have already happened.
def error_budget_remaining(slo, total_requests, failed_requests):
allowed_failures = (1 - slo) * total_requests
return allowed_failures - failed_requests
print(error_budget_remaining(0.999, 10_000_000, 4_000)) # about 6000 failures leftWith 10 million requests in the window, a 99.9% SLO allows about 10,000 failures. After 4,000 failures, about 6,000 remain. A negative result means the SLO has been missed for the window.
For a time-based SLI, the same idea applies to minutes. A 99.9% SLO over 30 days allows 43.2 minutes of downtime.
Burn rate
Total remaining budget does not tell you how fast you are using it. Burn rate does. A burn rate of 1 means you will use exactly the whole budget by the end of the window. A burn rate of 10 means you will use it in one tenth of the window.
The formula is the observed error rate divided by the allowed error rate:
def burn_rate(slo, error_rate):
return error_rate / (1 - slo)
print(burn_rate(0.999, 0.001)) # about 1.0, on pace to spend exactly the budget
print(burn_rate(0.999, 0.01)) # about 10.0, budget gone in 3 days of a 30-day windowBurn rate is the basis for useful alerts. Page someone when the burn rate is high enough that the budget will run out in hours. Open a ticket when it is only slightly above 1.
Using the budget to make decisions
The policy in the diagram is the main use of an error budget. Product and operations teams agree in advance what happens when the budget runs low. Typical rules are:
- Budget healthy: release as usual, and consider taking more risk, such as faster rollouts or experiments.
- Budget low: slow down, require extra review, and prefer small changes.
- Budget exhausted: freeze non-essential releases until the window recovers or the cause is fixed.
Agreeing on this before an incident matters. It replaces an argument about whether reliability or features should win with a rule both sides accepted earlier.
Common errors
- Budget set equal to the SLA. The SLA is the contractual promise. Set the internal SLO tighter than the SLA so you notice trouble before you owe a refund.
- Treating 100% as a goal. A 100% target leaves a budget of zero, so every change looks dangerous and nothing ships. Users also cannot tell the difference between 99.99% and 100% when their own networks fail more often.
- Counting the wrong events. If health checks or bot traffic dominate the request count, they dilute failures and make the budget look healthier than users experience.
- Ignoring window choice. A rolling 30-day window forgives old incidents gradually. A calendar-month window resets suddenly, which can encourage risky releases on the first day of the month.
- Spending the budget silently. Planned maintenance and partial outages should be counted by an explicit rule, not hidden. Later chapters cover what counts as down.
Exercise
A service has a 99.95% SLO over a 30-day window and handles 20,000,000 requests in that window. By day 20 it has failed 7,000 requests. How many failures remain in the budget, and what does that tell you about the rest of the window?
Show answer
The allowed failures are (1 - 0.9995) × 20,000,000 = 10,000. Subtracting the 7,000 already spent leaves 3,000 failures. The team should be careful for the remaining 10 days, since a single moderate incident could exhaust the rest, and under the agreed policy it should slow risky releases.