SRE in practice: how to define SLOs that make sense for the business
SLIs, SLOs, and error budgets explained with examples — and how to use them to balance delivery speed and reliability.
SRE$ sloth generate -i slo.yaml▍“We want 100% availability” is a goal no system ever meets, and one that paralyzes any team. The SRE approach proposes something more honest: define how reliable the service needs to be — and use the difference as a budget for innovation.
Concepts in 30 seconds
- SLI (indicator): the measurement. E.g., the proportion of HTTP requests answered successfully in under 300 ms.
- SLO (objective): the target for the SLI. E.g., 99.5% over a 28-day window.
- Error budget: what’s left over. At 99.5%, you’re allowed to “fail” 0.5% of requests.
Choose SLIs from the user’s perspective
CPU at 90% isn’t a problem if the user doesn’t notice it. Favor availability and latency indicators measured as close to the customer as possible — at the load balancer or the API gateway.
Example definition
service: checkout
slos:
- name: requisicoes-com-sucesso
objective: 99.5
sli:
events:
error_query: sum(rate(http_requests_total{job="checkout",code=~"5.."}[{{.window}}]))
total_query: sum(rate(http_requests_total{job="checkout"}[{{.window}}]))
Use the error budget to make decisions
- Budget to spare: the team can speed up releases and experiments.
- Budget exhausted: priority goes to stability, fixing root causes, and reducing deployment risk.
Burn-rate alerts
Instead of alerting on every spike, alert when the budget is being consumed too quickly (for example, 2% of the monthly budget in one hour). This cuts down on noise and focuses on what really threatens the SLO.
Start with one or two SLOs per critical service, review them every quarter, and involve the product team in defining them.