Course contents

13. Observability Lesson 5 of 6

SLIs, SLOs, and SLAs

Choose an SLI, set an SLO and its error budget, watch a bad canary burn it, and see how multi-window burn-rate alerts scale urgency to damage.

15 minIntermediate8 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • SLI = good events / valid events, measured close to the user (availability, latency, correctness).
  • SLO = target for the SLI over a window (e.g. 99.5% over 30 days); the remainder is the error budget.
  • SLA = contract with consequences, looser than the SLO, which is looser than normal performance.
  • Burn rate = error ratio ÷ (1 − SLO); alert when it is high over both a long and a short window.
  • An error budget policy says what happens when the budget runs low, agreed before incidents.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

A service level indicator (SLI) is a measurement of service quality as users experience it, expressed as the ratio of good events to valid events. A service level objective (SLO) is a target for an SLI over a time window. A service level agreement (SLA) is a contract with customers that specifies consequences, usually service credits, if a level is not met. The error budget is the allowed shortfall: 1 − SLO.

Why it exists

"Is the service reliable enough?" otherwise becomes a matter of opinion and of which dashboard someone looks at. SLOs make reliability a number agreed in advance: enough to keep users happy, not so much that every release becomes impossible. The error budget turns that number into a shared currency for product and engineering decisions and for alerting.

How it works

Choose SLIs for important user journeys: availability (share of requests that succeed), latency (share faster than a threshold), sometimes freshness or correctness. Measure where users' experience is visible: at the load balancer, gateway or client, not on hosts. Define "valid" (exclude, for example, client errors caused by bad input) and "good" precisely.

Set the SLO: target and window, e.g. 99.5% over a rolling 30 days. Base it on what users need and what you achieve today, not on aspiration. 99.9% over 30 days allows 43.2 minutes of total outage; 99.5% allows 3.6 hours.

Error budget. At 100 req/s, 30 days is about 259 million requests; a 99.5% SLO allows about 1.3 million bad ones. Deploys, experiments, dependencies and bad luck all spend from it.

Burn rate = observed error ratio ÷ budget ratio. Burn 1 uses the budget exactly over the window; burn 10 uses a 30-day budget in 3 days. The Google SRE Workbook recommends multi-window, multi-burn-rate alerts, for example: page when burn > 14.4 over 1 hour and over 5 minutes (2% of a 30-day budget in an hour); page when burn > 6 over 6 hours and 30 minutes (5% in 6 hours); ticket when burn > 1 over 3 days. The long window gives significance, the short one makes the alert stop soon after recovery.

SLA sits below the SLO (e.g. 99.0% vs 99.5%), so you get internal warning before contractual breach. SLAs often use coarser measurements (monthly uptime from external probes).

Error budget policy. Agreed in advance: while budget remains, ship; when it is exhausted, freeze risky changes and prioritise reliability work until the SLI recovers.

When to use it

For any service with users who care about its reliability, internal platform services included. SLOs are most valuable when several teams must agree on priorities, or when alert noise is a problem.

When not to

  • For every internal metric: SLOs belong to user-facing behaviour, a handful per service.
  • When you cannot measure the user experience yet: fix the measurement first.
  • A 100% SLO: it leaves no budget for any change and cannot be met in practice.

Trade-offs

Choice You gain You pay
Stricter SLO (more nines) Happier users at the margin Much more engineering, slower releases
Longer window (30 vs 7 days) Stable, less noisy target Slow to reflect improvements
Request-based SLI Precise, weights by traffic Low-traffic periods can be noisy
Time-based SLI (good minutes) Simple, matches uptime SLAs Hides partial failures within a minute
Burn-rate alerts Pages scaled to damage, fewer false pages More complex rules to set up

Alternatives

  • Threshold alerts on symptoms (error rate > 1% for 5 minutes): simpler, but either noisy or slow, and not tied to a budget.
  • Uptime monitoring only: external probes see total outages, not partial failures or slow responses.
  • Apdex: a single satisfaction score from latency thresholds; less flexible than separate SLIs.

Failure modes

  • Measuring hosts, not users: health checks and CPU look green while a canary or a dependency fails users.
  • Average-based latency SLIs: hide tail latency; use thresholds or percentiles.
  • Too many SLOs: nobody knows which ones matter; alerts multiply.
  • SLO nobody acts on: no error budget policy, so budget exhaustion changes nothing.
  • SLA tighter than SLO: contractual breach comes before any internal warning.

In production

Define two or three SLIs per critical journey, measure them at the edge from request logs or metrics, set SLOs with product owners, publish dashboards with remaining budget, alert with multi-window burn rates linked to runbooks, and review SLOs every quarter. Canary releases should be judged automatically against the SLI, not only against host health.

Common misconceptions

  • "Higher is always better." Every additional nine costs roughly ten times more and slows change.
  • "If every server is healthy, we meet the SLO." Health checks test hosts, often shallowly.
  • "An error budget is permission to be careless." It is a planned allowance that funds change and absorbs bad luck.
  • "SLA and SLO are the same." One is a contract with consequences, the other an internal target.

Interview angle

Expect to define SLIs for a system you design ("availability: share of non-5xx responses at the gateway; latency: share of requests under 300 ms"), set SLOs with reasons, compute an error budget in minutes or requests, and explain burn-rate alerting. Mention that the SLA is looser than the SLO and that SLOs drive release decisions through an error budget policy.

Model assumptions

Simulated: three stable app servers (8 workers, 30 ms) and a canary behind a smooth weighted-round-robin balancer with health checks every 500 ms; the canary (weight 1 of 19, later 6 of 24) calls a Recommendations service that is down, so its requests fail while its health checks pass. The SLI, error ratio and burn rate in the text are computed from the simulated requests. The 30-day budget, alert windows and incident cost are arithmetic on those rates, not simulated: a lesson step runs for seconds. Arrivals are Poisson, service times lognormal. Numbers show behaviour, not benchmarks.

The lesson as textEvery step of the simulation, written out.
  1. 1. An SLI measures what users feel

    Users send about 100 requests a second to three app servers. Which number says whether they are happy? Not CPU, not memory: those are causes. A service level indicator (SLI) is a ratio of good events to valid events, measured as close to the user as you can.

    Here: *the share of requests that succeed and answer within 300 ms*, measured at the load balancer. Right now practically every request is good: the SLI is at 100%.

    Scene: Users send about 100 requests per second through a load balancer to three app servers. Every request succeeds quickly; the SLI, the share of requests that succeed within 300 ms, is about 100%.

    Key idea: SLI = good events / valid events, chosen to reflect what the user experiences (availability, latency, correctness).

  2. 2. An SLO sets the target, and the budget

    A service level objective (SLO) is a target for the SLI over a window: *99.5% of requests are good, over a rolling 30 days*. Not 100%: users cannot tell 99.99% from 100% through their own Wi-Fi, and every extra nine costs a lot more engineering.

    The gap is the error budget: 0.5% of requests may be bad. At 100 requests a second, 30 days are about 259 million requests, so roughly 1.3 million bad requests are allowed. The budget is what you spend on deploys, experiments and bad luck.

    Scene: The same healthy system. An SLO of 99.5% good requests over 30 days is set; the error budget is 0.5% of requests, and nothing is being spent right now.

    Key idea: An SLO is a target below 100%; the remainder is an error budget you are allowed to spend.

  3. 3. An SLA is a promise with consequences

    A service level agreement (SLA) is a contract with customers: if availability falls below, say, 99.0% in a month, they get service credits. It is a business document, usually measured more coarsely than your SLI.

    Keep the SLA looser than the SLO (99.0% vs 99.5%) and the SLO looser than what you normally achieve. The SLO then warns you, internally, long before you break a promise that costs money. Many internal services have SLOs and no SLA at all.

    Scene: The same healthy system, annotated with an SLA of 99.0% for customers and an internal SLO of 99.5%; the system currently delivers about 100%.

    Key idea: SLA (contract) ≤ SLO (internal target) ≤ what you usually deliver. The SLO is your early warning.

  4. 4. A canary that fails quietly

    Release v2 goes out as a canary: one new server with weight 1 against the others’ 6, so it gets about 1 request in 19 (5%). v2 calls a new Recommendations service, which is down. Every request the canary takes fails, and the error tile settles around 5%.

    The balancer keeps the canary in rotation: its health check only asks whether the canary process answers, and it does. The servers look healthy; only the user-facing SLI shows the damage, because it counts what users get, not what hosts report.

    Scene: A canary server running v2 receives about 5% of the traffic. It calls a Recommendations service that is down, so all its requests fail and the error rate is about 5%. Health checks still pass, so the balancer keeps the canary in rotation.

    Key idea: Host health can be green while users fail. The SLI, measured at the edge, sees it.

  5. 5. Burn rate: how fast the budget goes

    Is 5% errors an emergency? Divide the error ratio by the budget ratio: about 5% ÷ 0.5% ≈ a burn rate of 10. At burn rate 1 the budget lasts exactly 30 days; at 10 it is gone in 3 days.

    Alerting on burn rate instead of raw error rate is the approach in Google’s SRE workbook. Typical multi-window rules: page if burn > 14.4 over 1 hour *and* the last 5 minutes (2% of the budget in an hour); page if burn > 6 over 6 hours *and* 30 minutes (5% in six hours); open a ticket if burn > 1 over 3 days. At burn 10 the 1-hour page stays quiet; the 6-hour rule fires once its window has averaged above 6, after about 3.6 hours.

    Scene: The canary still fails about 5% of requests. That is a burn rate of about 10: the 30-day error budget would last about 3 days. The 6-hour burn-rate alert would fire; the 1-hour one would not.

    Key idea: Burn rate = error ratio ÷ (1 − SLO). Alert on how fast the budget is going, over a long and a short window.

  6. 6. The release is promoted: fast burn

    Nobody looked at the SLO dashboard, and the release is promoted: the canary’s weight goes from 1 to 6, so it now gets a quarter of the traffic. The error tile jumps to about 25%.

    That is a burn rate of about 50: the whole month’s budget would be gone in about 14 hours. The fast-burn rule (> 14.4 over 1 hour and 5 minutes) pages within about 17 minutes, by which point about 2% of the budget is spent. Short windows exist for exactly this: big burns need a fast page, small ones a slow ticket.

    Scene: The canary’s weight rises to 6 and it now receives about a quarter of the traffic. The error rate jumps to about 25%, a burn rate of about 50, which triggers the fast-burn page.

    Key idea: The bigger the burn, the sooner the page: multi-window burn-rate alerts scale detection time to damage.

  7. 7. Roll back, then count the cost

    The on-call engineer is paged and rolls back: the canary leaves the pool. The error tile returns to zero; the SLI is back at about 100%.

    The SLO turns the incident into a number. Roughly: 4 hours at burn 10 plus 20 minutes at burn 50 is about 57 hours of normal budget, close to 8% of the month’s budget (illustrative arithmetic). Not a disaster, and the SLO says so objectively: no argument about whether "5% errors" was bad enough to matter.

    Scene: The canary is removed from the pool. The error rate returns to zero and the SLI to about 100%.

    Key idea: An error budget makes the cost of an incident measurable and comparable.

  8. 8. Spending the budget on purpose

    An error budget policy says what happens as the budget runs low: with budget left, ship features and experiment; when it is exhausted, freeze risky releases and spend engineering time on reliability until it recovers. Product and engineering agree on it *before* the incident.

    Keep SLOs few (a handful per service), on user journeys, and review them: an SLO nobody ever breaks is too loose, one that pages every week is too tight. Latency SLIs use thresholds or percentiles (P95/P99), never averages.

    Scene: Three healthy v1 servers serve all traffic; the canary and the Recommendations service are out of the pool.

    Key idea: SLOs turn reliability into a budget that product and engineering spend together.