Part 7 of 8 · 2 min read
Choosing them
Start from the user's journey.
Choosing SLIs and SLOs for a service
A short method, built from UDS's advice:
- List the things users do: search, add to cart, pay.
- For each, choose one or two SLIs: success ratio and speed for the user-facing calls, completeness for stored data.
- Measure as near the user as is affordable.
- Set a first SLO using the real data from a few weeks, then ask users or product owners whether it matches their needs.
- Write down the window, the budget and the policy for when it is spent.
- Review it every quarter.
A worked example (made up). A checkout API. SLI 1: share of requests that return success, measured at the load balancer. SLO 1: 99.9 percent over 30 days. SLI 2: share of requests under 800 ms, measured at the client. SLO 2: 99 percent over 7 days. Policy: if either budget is below 25 percent with more than half the window left, release only fixes.
Interview angle
Answer in your head first, then open it.
What is an SLI, SLO and SLA?
SLI is the measurement, SLO is the target for it, and SLA is a contract with consequences when the target is missed.
What is an error budget?
The amount of failure the SLO allows. When it is spent, repairs come before features.
Why not use average latency?
One outlier skews it and it hides the share of users who suffer. Use percentiles.
How do you choose an SLO?
Start from what users care about and what data shows, begin comfortable, and tighten. Above three nines costs a lot.
Check yourself: 1. Name an SLI for a file upload service. 2. Why must product managers agree to an SLO? 3. What does the sample policy do when the budget runs low?
Words you will meet
| Word | Meaning |
|---|---|
| Black-box monitoring | Testing from outside, as a user |
| White-box monitoring | Measurements reported from inside the service |
| Metric | A measurement stored as numbers over time |
| Label | A key and value tag that says where a metric came from |
| Pre-aggregation | Summing or averaging samples over fixed periods before storing |
| SLI | A measure of service quality, as good over total |
| SLO | A target for an SLI over a window |
| SLA | A contract with consequences if the SLO is missed |
| Error budget | The amount of failure an SLO allows |
| Long-tail latency | The response times at the highest percentiles |