Lesson 23 / 35
SLIs, SLOs, SLAs and Error Budgets
Define an SLI, set an SLO, compute an error budget, and explain how the budget guides engineering decisions.
By Rahul Agarwal · 15 years in web development
Measuring reliability the way users feel it
A Service Level Indicator (SLI) is a measurement of user-visible behaviour, best expressed as a ratio of good events to total events: the fraction of checkout requests that succeeded, or that completed within 300 ms.
A Service Level Objective (SLO) is a target for that SLI over a window: "99.9% of checkout requests succeed, measured over 30 days". A Service Level Agreement (SLA) is a contract with customers that has consequences, such as credits, when broken. SLAs are usually looser than internal SLOs so you have a safety margin.
The error budget is the allowed unreliability: 100% minus the SLO. With 99.9%, one request in a thousand may fail. The budget turns reliability into a shared decision tool. If plenty of budget remains, the team can ship faster and take risks. If it is nearly spent, the team slows releases and prioritises reliability work.
Why not aim for 100%? Users cannot tell 99.999% from 100% through their own networks and phones, and each extra nine costs far more engineering effort.
From measurement to decisions
Pick an SLI that reflects users, set an SLO target, derive the error budget, watch its burn rate, and use what remains to drive decisions about releases and reliability work.
Error budget arithmetic
The same 99.9% SLO expressed as time and as requests.
slo = 0.999
days = 30
minutes = days * 24 * 60
print(f"allowed bad minutes in {days} days: {minutes * (1 - slo):.1f}")
requests = 120_000_000
budget = requests * (1 - slo)
print(f"allowed failed requests: {budget:,.0f}")
failed_so_far = 54_000
print(f"budget used so far: {failed_so_far / budget:.0%}")
Output:
allowed bad minutes in 30 days: 43.2 allowed failed requests: 120,000 budget used so far: 45%
A monthly mobile data pack
A 30 GB monthly pack is a budget. If you have used 5 GB by day 20, you can stream freely. If you used 25 GB in the first week, you cut back on videos. An error budget works the same way: it tells a team when it can spend reliability on speed and when it must save.
Quick check: An API has a 99.5% availability SLO over 30 days and receives 2,000,000 requests in that window. How many failed requests does the error budget allow?
- 1,000
- 5,000
- 99,500
- 10,000
Answer
10,000 — The budget is 0.5% of 2,000,000 requests, which is 10,000. 1,000 would be a 99.95% target.