ealeng

Episode 51 of 55 · Operations

SLOs and burn-rate alerts: a 1% alert paged about 200 times in a normal week, and the budget alert paged none

A checkout service with a 99.5% SLO over 28 days: the common alert (page when more than 1% of requests failed in the last minute) paged 197 to 201 times in three simulated normal weeks. Burn-rate alerts, which page when a share of the error budget is spent fast, paged and ticketed none of them, and still paged a full outage in 4.5 minutes. Neither alert could see that a failover lost about 190 acknowledged writes.

Lab 21 · SLOs and Observability13 min read
Video transcript8:12

0:00Cold open

0:01

I gave a checkout service the alert most teams start with: page someone when more than one percent of requests failed in the last minute.

0:11

In a simulated normal week, it paged about two hundred times. For short blips nobody needed to see.

0:20

An alert built on an error budget sent no pages that week. And it still paged a full outage within five minutes.

0:29

But a failover that lost about a hundred ninety confirmed writes? The budget alert stayed quiet, and the other saw only a one-second blip.

0:39

So what should wake you up, and what can’t these alerts see?

0:45Intro

0:46

Hands-on system design, part fifty-one.

0:50

Today: service level objectives, error budgets, and alerts that page for what matters.

0:57Meet Lucía

0:59

I’m Lucía, a platform engineer, and I’m the one who gets paged at night. So I want alerts that mean something.

1:06

First, what counts as good. Here: a checkout answered OK within three hundred milliseconds. That measure is the SLI, the service level indicator.

1:18

The promise: ninety-nine and a half percent of checkouts good, over twenty-eight days. That’s the SLO, the service level objective.

1:27

The other half percent is the error budget: failures you’re allowed to spend.

1:33

Think of a monthly allowance. Burn rate is how fast you spend it; at one, it lasts exactly the month.

1:42

A page means “at this pace, broke within days”: wake someone. A ticket means “broke before the month ends”: look tomorrow.

1:5201 · What you need

1:53

To run it yourself, you need only Python: none of this needs a running service.

2:00

The traffic is made up, so I know exactly when an alert should fire. The failures are recordings from earlier parts, replayed. The quick tests pass in a few seconds.

2:1202 · What 99.5% allows

2:14

Ninety-nine and a half percent, over twenty-eight days, allows about three hours and twenty minutes of complete downtime.

2:23

So one thirty-minute outage spends about fifteen percent of the month’s budget.

2:29

At ninety-nine point nine, the same outage spends three quarters of it: five times less room.

2:3803 · A steady burn

2:39

First, simulated traffic: a hundred requests a second, three normal days, then a steady share of them failing. From a little, up to everything.

2:50

With every request failing, how long until the budget alert pages?

2:57

Four and a half minutes. Here’s the rule: page when the last hour spent budget over thirteen times too fast, and the last five minutes did too.

3:08

Everything failing spends two hundred times too fast, so the hour’s average passes thirteen after about four minutes. Checks run every thirty seconds, so the page came at four and a half.

3:2204 · Slow burns

3:23

At a burn of ten, five percent failing, the budget would be gone in under three days. The six-hour rule paged after three hours twenty, a few minutes before the formula, because the usual errors were already in the window.

3:38

At five, it would last almost six days. No page: a ticket after about twelve hours. Someone looks at it in the morning.

3:48

Now the one-percent alert. It fired within thirty seconds, for the full outage.

3:54

And within thirty seconds for every burn of five or more; for burn two, sitting right on the line, after ninety seconds. The same alarm for a problem that ends the month in hours, and one that takes days.

4:1005 · In code

4:11

Each rule is a share of the budget and two windows. Page: two percent in an hour, or five in six hours. Ticket: ten percent in three days.

4:22

At burn one, two percent of the budget lasts two percent of twenty-eight days, about thirteen hours. Spending it in one hour is thirteen times too fast.

4:33

And it fires only when both windows are over the line. The long one shows it’s big enough to matter. The short one makes the page stop soon after the problem does.

4:4506 · Real failures

4:47

Now real failures, recorded in earlier parts, replayed second by second after three normal days.

4:55

Part forty-one’s retry storm, still down when the recording ended. If nobody stepped in for an hour: thirty percent of the budget. It paged in four and a half minutes.

5:07

Part forty-three’s killed database: two seconds with every checkout failing, then fine. Two hundredths of a percent of the budget, and no page. Right: it fixed itself before anyone could. The one-percent alert paged anyway.

5:24

And a made-up slow failure, five percent for six hours: about the same as the burn of ten before. It paged after about three and a third hours.

5:3607 · Lost writes

5:37

Then part forty-three’s cut-off database, with the quick copy that says “saved” before the replica has it. About a hundred ninety confirmed writes were lost, under a hundredth of a percent of the budget. No budget page; the one-percent alert fired for the one-second blip. Neither saw the lost writes.

5:57

Relaxed sync lost about as many. Only strict copying, which waits for the replica, lost nothing. But it couldn’t take any writes until the old node was rebuilt. If that takes an hour: thirty percent, and a page.

6:12

Why? The indicator counts requests that failed. A write that was told “saved” and then vanished was a success, as far as it can tell. Lost data needs its own check.

6:2608 · A normal week

6:27

Last, a normal week. Blips I made up, to stand in for a busy service’s everyday noise: traffic rising and falling through the day, and thirty short error spikes a day. I simulated three such weeks, each with different random spikes.

6:44

How many times would the one-percent alert page in that week?

6:50

About two hundred a week. Twenty-eight a day. Nobody keeps reading pages like that, so the real one is easy to miss.

6:59

Wider thresholds cut it, to a few dozen, or one or two. But the five-percent one never fires below five percent failing: a burn of five, gone in under six days, goes unseen. And the five-minute hold delays every page by five minutes.

7:17

The budget alerts: no pages, no tickets, in any of the three weeks. The week cost under a fifth of the budget: affordable, so nobody was woken.

7:28Back to Lucía

7:30

So, three lessons.

7:33

Alert on the budget, not the error rate: fast when the budget is running out, quiet when it isn’t.

7:40

Short failures that fix themselves shouldn’t wake anyone.

7:45

And an availability promise can’t see lost data. Count it separately.

7:51

Next time: one service got slower. Which one? And what does tracing every request cost?

7:58

For today: page on the budget, and count the data too.Lucía: Page on the budget. Count the data too.

8:03Summary

8:04

Page on the budget, let short failures pass, and check lost data separately.

Key takeaways

  • ✓A 99.5% SLO over 28 days allows 0.5% of requests to fail, which is about 3.36 hours of complete outage, so one 30-minute outage spends about 15% of the month's error budget and the same outage spends 74% of a 99.9% budget.
  • ✓The common alert, which pages when more than 1% of requests failed in the last minute, paged 201, 197 and 199 times in three simulated normal weeks, about 28 times a day, for short error spikes that together spent only 17 to 19% of the budget.
  • ✓A burn-rate alert pages when a share of the budget is spent too fast: 2% in the last hour (checked over the last 5 minutes too) or 5% in the last 6 hours, and in the same three weeks the burn-rate alerts sent no pages and no tickets.
  • ✓With every request failing (a burn of 200), the 1-hour burn-rate page fired after 4.5 minutes, when 2.2% of the budget was gone, while a 5% failure rate for 6 hours (a burn of 10) paged after 3 hours 20 minutes, when about 5% of the budget was gone.
  • ✓A 2.3-second failover that healed itself spent 0.02% of the budget and should not have woken anyone, but the 1% alert paged for it at 30 seconds, and the burn-rate alerts stayed quiet.
  • ✓An availability SLO counts requests that failed, so a partitioned failover that lost a median of 190.5 acknowledged writes while spending 0.01% of the budget raised no burn-rate alert: lost data needs its own check.

In the lab, a checkout service with a 99.5% SLO (a promise that 99.5% of checkouts are good over 28 days) was judged by two sets of alerts on the same traffic. The alert most teams start with paged about 200 times in a simulated normal week. The burn-rate alerts paged none, yet still paged a full outage within 4.5 minutes. Neither set could see a failover that lost about 190 writes the service had already confirmed.

The examples come from Lab 21 (SLOs and Observability) of the system design labs. Three files do the work: slo.py holds the SLO and the alert rules as code, 01_slo_math.py runs the budget arithmetic and a constant burn with a known answer, and 02_replay.py replays recorded failures and a simulated normal week against the same rules. The lab needs only Python: no services run, and the traffic is generated. Each configuration is one recorded run, and the numbers below come from that run's results.

What an SLO and an error budget are

The SLI, the service level indicator, is the measure of good. Here a checkout is good if it answers 2xx (a success status) within 300 milliseconds. The SLO, the objective, is the target for that measure: 99.5% good over 28 days. The error budget is the rest, 0.5%: the failures the promise allows you to spend.

Think of a monthly allowance. The budget is what you can spend before you break the promise, and burn rate is how fast you are spending it. A burn rate of 1 spends the whole allowance in exactly 28 days. A burn rate of 200 means every request is failing, which spends the month's allowance 200 times too fast and empties it in about 3.4 hours.

The lab's alerts use two words for what they want you to do. A page means the budget is going fast enough that it will be gone within days, so a person is woken. A ticket means it will be gone before the month ends, so someone looks at it in the morning.

What 99.5% allows

Over 28 days, each extra nine divides the budget by ten, and the cost of earning it grows with it. The lab's arithmetic for five objectives:

Objective Full downtime allowed Bad requests per million One 30-minute outage spends
99% 6.7 h 10,000 7%
99.5% 3.4 h (about 3 hours 20 minutes) 5,000 15%
99.9% 40 min 1,000 74%
99.95% 20 min 500 149%
99.99% 4 min 100 744%

The 99.5% row is the one the rest of this chapter uses.

Threshold alert and burn-rate alert

The threshold alert is the simple rule: page when the error ratio over the last window is above a number. The lab's version pages when more than 1% of requests failed in the last minute. This chapter calls it the 1% alert. It has no idea how much budget a failure costs. A one-second blip and a day-long outage at the same rate look identical to it.

A burn-rate alert asks how much of the budget a failure has used. The lab uses the rules from Google's SRE Workbook, defined by the share of the budget they must catch:

  • Page: 2% of the budget spent in 1 hour (the 1-hour page).
  • Page: 5% of the budget spent in 6 hours (the 6-hour page).
  • Ticket: 10% of the budget spent in 3 days (the 3-day ticket).

Each rule has two windows. The long window (1 hour, 6 hours, 3 days) shows the problem is big enough to matter. The short window (5 minutes, 30 minutes, 6 hours) makes the alert stop soon after the problem does. The rule fires only while both windows are over the line.

The burn number a rule needs follows from its share: threshold = share × 28 days ÷ long window. That gives a burn of 13.44 for the 1-hour page, 5.6 for the 6-hour page, and about 0.93 for the 3-day ticket.

A steady burn

The first test is a constant burn with a known answer. The traffic is 100 requests a second for 3 normal days, with 0.05% failing, and then a steady share of requests fails. The widget below shows what each alert did at each burn rate in that recorded run.

Try it · One constant burn, recordedLab 21 · 01_slo_math.py, recorded run

A 99.5% SLO. From a moment after 3 normal days, every checkout fails at the stated share (burn 200 is a full outage). Pick a burn rate: the burn is how many times faster than allowed the budget is being spent.

Failing share
5%
Budget gone in
2.8 days
Page after
3.3 h
Formula predicted the page at3.4 h
Budget spent when the page fired5.0%
Ticket (3 days, 10% of the budget) after6.1 h
The 1% alert (over 1% failed in the last minute) after30 s
Budget spent when the page firedscale 0 to 6%
5.0%

Recorded values. The page fires after about 2 to 5% of the budget is gone, whatever the burn: that is the design. Slow burns get a ticket instead, and burn 1 never pages.

Every request failing is a burn of 200, and the 1-hour page fired at 270 seconds, 4.5 minutes, with 2.2% of the budget gone. The formula predicted 242 seconds; the checks ran every 30 seconds, which accounts for the rest.

Burn Failing share Budget gone in Page after Formula Budget spent at the page Ticket after 1% alert after
1 0.5% 28 days never never none 66 h never
2 1% 14 days never never none 32 h 90 s
5 2.5% 5.6 days never never none 12 h 30 s
10 5% 2.8 days 3 h 20 min 3 h 22 min 5.0% 6.1 h 30 s
20 10% 34 h 40 min 40 min 2.0% 3.0 h 30 s
100 50% 6.7 h 8.5 min 8.1 min 2.1% 37 min 30 s
200 100% 3.4 h 4.5 min 4.0 min 2.2% 19 min 30 s

A burn of 1 is the case the 1% alert misses entirely: it uses the whole budget exactly, but never exceeds 1% failing, so it never fires. Only the ticket notices it, after 66 hours.

Slow burns

Slow burns are the ones that matter for planning rather than for waking people. At a burn of 10, the budget would be gone in under three days, and the 6-hour page is the rule built for that case. At a burn of 5, the budget would last almost six days, and the lab gives a ticket after about 12 hours and no page. Someone looks at it in the morning.

The 1% alert, in contrast, fires within 30 seconds for every burn of 5 or more, and for a burn of 2 after 90 seconds, right on its line. It is the same alarm for a problem that empties the budget in hours and one that takes days.

Real failures, replayed

The second test replays failures that were recorded in earlier labs. Each recording is placed after 3 normal days, and its share of failing requests per second is taken from the recording. Lab 17 (Overload, Rate Limits and Backpressure) recorded a retry storm, where clients that retry at once pile more load onto a server that is already overloaded (episode 41). Lab 18 (Failure, Failover and Recovery) recorded database failovers (episode 43). Two runs never recovered within the recording, so the lab holds their last 15 seconds for an hour. That is an assumption, a stand-in for "nobody intervened", and the numbers for those rows depend on it.

Failure Budget spent Page after Ticket after 1% alert after Acknowledged writes lost
Retry storm, no retries (recovered after 15 s) 0.20% none none 30 s
Retry storm, immediate retries (held 1 h) 30.2% 4.5 min 18.5 min 30 s
Retry storm, backoff retries (held 1 h) 30.2% 4.5 min 18.5 min 30 s
Retry storm, retry budget (recovered after 27 s) 0.30% none none 30 s
Retry storm, bounded queue with deadlines (recovered at once) 0.05% none none 30 s
Failover, primary killed (async, 2.3 s without writes) 0.02% none none 30 s 0
Failover, primary partitioned (async, 1.0 s) 0.01% none none 30 s 190.5 (median)
Failover, primary partitioned (sync, 1.2 s) 0.01% none none 30 s 197
Failover, primary partitioned (strict sync, writes never resumed, held 1 h) 29.7% 4.5 min 18.5 min 30 s 0
Reference: a full outage for 30 minutes 14.9% 4.5 min 18.5 min 30 s
Reference: 5% failing for 6 hours 8.8% 3 h 21 min none 30 s

"Async" here is the quick copy that says a write is saved before the replica (the backup copy) has it. "Sync" is the middle setting, and "strict sync" waits for the replica and loses nothing, but takes no writes while the replica is cut off.

The pattern: the failures that mattered paged in 4.5 minutes, and the ones that healed did not page. The 1% alert paged for every one of them, including the 2.3-second failover that spent 0.02% of the budget. The 5%-for-6-hours case is the slow one that the 6-hour page exists for.

What it can't see: lost writes

The last rows are the point of the lab. In the partitioned failovers, the primary was cut off, and about 190 writes the service had already confirmed as saved disappeared. The budget alert stayed quiet, and the 1% alert saw only a one-second blip.

The reason is the indicator. It counts requests that failed. A write the service told the customer was saved, and then lost, was a success as far as the indicator can tell. The strict-sync setting lost nothing, but it refused writes until the old node was rebuilt. The lab held that case for an hour, which spent 29.7% of the budget and paged after 4.5 minutes. The data-loss problem therefore needs its own check, with its own objective, such as confirming that every acknowledged write is still there.

A normal week

The last test is a simulated normal week, to count the false pages. The traffic rises and falls through the day, with 0.05% of requests failing and 30 short error spikes a day (20 seconds to 3 minutes, 2% to 15% of requests failing). The spikes are made up to stand in for a busy service's everyday noise. The lab ran three such weeks, each with different random spikes; a seed is the number that fixes which random spikes a run gets.

Try it · A simulated normal weekSimulated traffic, seeded · Lab 21 · 02_replay.py

Traffic that rises and falls through the day, 0.05% of requests failing, and 30 short error spikes a day. The spikes are random and differ by seed. Each seed is a different week of the same traffic.

Pages: more than 1% failed in the last minute201
Pages: more than 5% failed over 5 minutes34
Pages: more than 1% failed for 5 minutes2
Pages: burn-rate alerts (page rules)0
Tickets: burn-rate alerts (3-day rule)0
Budget spent in the week
18.7%
Pages per day, threshold alert
28.7

Recorded from the lab's simulated runs. The burn-rate alerts sent no pages and no tickets in all three seeds.

Seed Spikes Budget spent in the week More than 1% over 1 min More than 5% over 5 min More than 1% for 5 min Burn-rate pages Tickets
0 210 18.7% 201 34 2 0 0
1 210 16.7% 197 33 1 0 0
2 210 16.8% 199 37 1 0 0

About 200 pages a week is about 28 a day. Nobody keeps reading pages like that, so a real page is easy to miss. Wider thresholds cut the count: 34 a week at 5% over 5 minutes, or 1 to 2 with a 5-minute hold. But the 5% alert never fires below 5% failing, so a burn of 5 goes unseen, and the 5-minute hold delays every real page by 5 minutes. The burn-rate alerts sent no pages and no tickets in any of the three weeks, and the whole week cost under a fifth of the budget.

Workflow and results

  1. 01_slo_math.py builds the objective and the budget arithmetic from slo.py, then runs the constant burns and records when each alert fired, and how much budget was gone by then.
  2. 02_replay.py takes the recorded failures from Labs 17 and 18, places each after 3 normal days, and records each alert's firing time. It then runs the three simulated weeks.
  3. The results are written to data/results/01_slo_math.json and 02_replay.json. Every number on this page comes from those two files or from the lab README's tables built from them, except the budget table, which is arithmetic from the objective.

Caveats

  • Simulated and recorded are different. The constant burns and the normal weeks are synthetic traffic with seeded random spikes. The replays are recorded failure shares from Labs 17 and 18, but each recording is one run.
  • Held failures are assumptions. The two retry-storm runs that never recovered, and the strict-sync failover, are held at their last rate for an hour. The 30% figures and their 4.5-minute pages assume nobody intervened for that hour.
  • One run per row. Each configuration is one recorded run on one laptop. The numbers are not a confidence interval.
  • Detection is quantized. Rules are checked every 30 seconds, as Prometheus (the metrics system the lab uses) checks them, so every firing time is a multiple of that step, plus or minus a check.
  • Not covered here. The lab's other exercises are out of this chapter: the tracing exercises, the tracing overhead and cost checks, and the live check that the generated Prometheus rules fire when the calculator says they should. Low-traffic services, where one failure is a large share of a few requests, are also not tested.
  • Latency and correctness SLIs are not measured. The SLI here is the 2xx-within-300-ms share of checkouts. A latency or a correctness indicator would need its own objective.

The checklist

  1. Write the objective as a budget. A 99.5% SLO over 28 days allows 3.36 hours of complete outage, and every outage spends part of it.
  2. Alert on the burn rate, not the error rate. Page when a share of the budget is spent fast, and ticket the slow burns.
  3. Give each rule two windows. The long one shows the problem is significant and the short one stops the page soon after the fault ends.
  4. Count lost data separately. An availability SLO cannot see writes that were acknowledged and then vanished.
  5. Expect a normal week to have noise. Count the pages a simple threshold alert would send in a normal week before you choose its numbers.

Quiz

Try it · Check your understanding0 of 3 answered
  1. 1.A 99.5% SLO over 28 days, and one 30-minute outage in which every request fails. How much of the month's error budget does that outage spend?

  2. 2.In the lab's constant-burn run, 5% of checkouts fail for six hours (a burn of 10 on a 99.5% SLO). Which alert fires, and when?

  3. 3.A failover acknowledges about 190 writes as saved, then loses them. Why did the availability SLO show no problem?

Check your understanding

Try each question before opening its answer.

Why did the 1% alert fire at 30 seconds for a 2.3-second failover, and why should a burn-rate alert not page for it?

The 1% alert looks at a single minute, and a failover that drops every request for 2.3 seconds pushes that minute over 1% failing, so it fires at the next 30-second check. A burn-rate page needs 2% of the whole budget in an hour. The failover spent 0.02% of the budget, so it never reaches that line. Waking someone for it costs time and buys nothing, because the failure fixed itself.

Why does each burn-rate rule need a short window as well as a long one?

The long window, 1 hour for the 1-hour page, shows the budget loss is big enough to matter. The short window, 5 minutes, makes the alert stop soon after the problem does. Without it, a fault that ended 10 minutes ago would still page for the rest of the hour.

Why did the 5% failure rate for six hours page at about 3 hours 20 minutes, and not on the 1-hour page?

A burn of 10 is below the 1-hour page's threshold of 13.44, so that rule cannot fire. It is above the 6-hour page's threshold of 5.6. The 6-hour rule fires once the budget spent in the last 6 hours passes 5%, which at a burn of 10 happens after about 3 hours 20 minutes, with 5% of the budget gone.

Strict sync lost no acknowledged writes. Why is it not the answer to the lost-writes problem?

Because it stopped taking writes until the old node was rebuilt. In the lab, that case was held for an hour, and it spent 29.7% of the monthly budget and paged after 4.5 minutes. Losing a write and refusing all writes are both failures, and an availability SLO counts the refusals. The choice is between them, made in advance.

Next up: Chapter 52, distributed tracing. This chapter showed that checkouts were failing or slow. The next one asks which service is responsible, when metrics point at three of them, and what it costs to trace every request.

Learning something useful?

New labs, articles, and videos on evaluating and testing AI systems come out regularly. Follow along so you don't miss the next one.