← Math
Math

SLOs, error budgets, and burn rate

The 30-day figure is green. Should anyone be woken up?

Measure failures against their allowance and use recent burn to apply an explicit response policy.

Outcome

Turn a target into an error budget, compute burn over a short and a long window to decide on a page, and estimate the hours the remaining budget lasts.

Terminology (6)Terms used in this lesson

Term on the front, definition on the back. Paste with tabs between fields and a new line between cards, or import the download in Anki as Basic.

SLO
A service level objective: the share of eligible requests that must be good over a window, such as 99.9% over 30 days.
SLI
The measured share of good requests that the SLO is judged against.
Error budget
The bad requests the SLO allows over its window: eligible requests × (1 − target).
Burn rate
How many times faster than allowed the budget is being spent: a window’s error rate divided by 1 − target.
Basis point
One hundredth of a percent; 99.9% is 9,990 basis points.
Page
An alert that wakes the on-call engineer, as opposed to a ticket handled in working hours.

Why this matters

An availability target sounds like a grade: 99.925% is above 99.9%, so things are fine. Read as a budget it says something else. For a given eligible-request count, the target allows a corresponding number of failures; and the question on call is how fast they are being spent and how long the rest will last.

This lesson assumes percentages, ratios and rates per hour.

From a target to an error budget

A service-level indicator (SLI) measures the fraction of eligible requests that are good. A service-level objective (SLO) sets the target for that fraction over a period. The allowed bad fraction gives an error budget for the eligible-request count.

Budget used compares failures with that allowance. Burn rate compares a recent bad fraction with the allowed bad fraction, so windows with different request counts can be assessed against the same target. Converting burn into time left also needs a traffic assumption; the worked estimate freezes the allowance and carries the recent failure rate forward.

01An SLO is a budget

An SLO is a budget

A photo-backup app’s upload API has a 99.9% objective over 30 days. This evening uploads are failing more often than usual, but the 30-day dashboard tile still reads 99.925%, above target. A teammate suggests looking at it in the morning. Work out what the budget says.

A 99.9% target over 12,000,000 eligible uploads allows 12,000 to fail. 9,000 have failed, so 75% of the budget is gone and 3,000 remain. The dashboard tile shows the same counts as 1 − 9,000 / 12,000,000 = 99.925%, which looks comfortably green.

main.ts
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const allowed = 0.001; // a 99.9% SLO
const budget = 12_000_000 * allowed; // bad uploads allowed in 30 days

console.log(((9_000 / budget) * 100).toFixed(2)); // % of the budget used
console.log((30 / 1_500 / allowed).toFixed(2), (270 / 18_000 / allowed).toFixed(2)); // 5-minute and 1-hour burn
console.log(((budget - 9_000) / 270).toFixed(2)); // hours left at the last hour's rate
Which number tells you how close the service is to missing its objective?

02Burn rate

Burn rate

Burn rate compares a window’s error rate with the rate the target allows. In the last hour 270 of 18,000 uploads failed, 1.5%, against an allowed 0.1%: a burn of 15. For the table below, assume constant eligible-request traffic matching the period’s average and a fixed full-budget allowance. Then burn b spends that allowance b times as fast: duration720/b hours, and an hour spends100b/720 percent. Without that traffic assumption, burn remains a normalized bad fraction but does not alone determine hours or failure count.

Fixed30-day allowance at constant baseline traffic
BurnA full budget lastsOne hour spends
130 days0.14%
65 days0.83%
14.450 hours2%
2036 hours2.78%

prom-client’s Counter, labelled by outcome, gives the bad and total counts. The burn is usually computed in the monitoring system from rates over each window.

03Two windows and a minimum

Two windows and a minimum

The page rule here is a burn of at least 14.4 over both the last 5 minutes and the last hour, with at least 100 uploads in each. The short window tests recent behavior; the long window integrates the bad fraction over a longer span. Both being high does not prove the degradation was continuous for an hour, and budget consumed also depends on traffic volume.

Three evenings against the 14.4 rule
CaseLast 5 minutesLast hourDecision
This evening30 / 1,500 → 20270 / 18,000 → 15page
A brief blip12 / 600 → 2040 / 20,000 → 2no page
Few uploads3 / 50 → 60300 / 18,000 → 16.7no page: 50 < 100
The last 5 minutes burn at 20, the last hour at 2. Page?

04Time left in the budget

Time left in the budget

Freeze the current12,000-failure allowance for this planning estimate. At270 failures/hour, remaining 3,000/270=11.1 hours. This warns against waiting until morning if that rate persists. A real request-based budget changes with eligible traffic, and a rolling window also ages old successes and failures out; its actual exhaustion time needs those flows. Dividing the full 12,000 by 270 would say 44 hours, because it ignores the 9,000 already spent.

The same budget, but the last 5 minutes had 30 failures. How long does it last at that rate?

05What the counts mean

What the counts mean

06Make the evening page decision

Make the evening page decision

The upload API report first measures failures against the allowance, then applies the chosen short-and-long-window response rule. Its final request needs the unspent allowance and the actual recent window duration: using the full budget or failures per minute as failures per hour makes a reassuring but wrong time estimate.

An upload API on call

Budget used, the paired-window page rule, then the hours left.

  1. easy · M-SLO-V4-1 Budget used
  2. medium · M-SLO-V4-2 Paired-window page rule
  3. hard · M-SLO-V4-3 Hours left
In the frontend A budget status panel in Next.js and Svelte Optional

A status panel can show burn and hours left instead of a single availability figure. The same basis-point target and eligible/bad counts derive remaining allowance and the recent-window burn. No recent traffic leaves burn unavailable; an already exhausted allowance is still reported. Zero observed recent failures does not prove a zero future failure rate.

Estimate.tsx
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
type Window = { bad: number; total: number; minutes: number };

// Valid bounded counts/basis points as in the lesson; freeze the allowance for this estimate.
function describe(targetBp: number, eligible: number, bad: number, recent: Window) {
  const remainingUnits = eligible * (10000 - targetBp) - bad * 10000;
  const burn =
    recent.total === 0
      ? null
      : recent.bad / recent.total / ((10000 - targetBp) / 10000);
  const perHour = (recent.bad * 60) / recent.minutes;
  const hours =
    remainingUnits <= 0
      ? 0
      : perHour === 0
        ? Infinity
        : remainingUnits / 10000 / perHour;

  return { burn, hours };
}

export async function BudgetPanel() {
  const {
    targetBp,
    eligible,
    bad,
    recent
  }: { targetBp: number; eligible: number; bad: number; recent: Window } = await fetch(
    "https://status.example/api/slo/uploads",
    { cache: "no-store" }
  ).then((r) => r.json());
  const { burn, hours } = describe(targetBp, eligible, bad, recent);

  return (
    <p>
      {burn === null
        ? "No recent uploads; burn unavailable"
        : `Burning at ${burn.toFixed(1)}×`}
      ;{" "}
      {hours === 0
        ? "budget exhausted"
        : hours === Infinity
          ? "no failures observed in the recent window"
          : `about ${hours.toFixed(1)} h at this failure rate with a fixed allowance`}
      .
    </p>
  );
}

Check this idea later
At constant baseline traffic and a fixed full allowance, a service burns at exactly1 for 30 days. What happens to its budget?
Why does the page rule need a minimum number of requests?
Sources

Values above were computed in Node 22 and run in Go 1.27, Rust 1.99 and Apple clang 17. The upload API is a worked model.

Report a problem in this lesson

For typos, mistakes and things that don’t work. We read every report and fix what’s wrong, but we don’t reply here, so a question won’t get an answer.