Failure Modes & Isolation

A database serves 300 queries a second and gets 280. A 10-second network cut ends, and with one retry per query the service stays down until the load drops: every answer arrives after its client gave up.

Pick a retry policy and drag the load, then watch the useful answers after the cut. Then we build, piece by piece, correlated faults, repair time, bad pushes, overload, retry storms, metastable states, gray failure and the walls that contain them.

You need what a server and a request are and what a probability is. Load Balancing helps. We build the rest from zero.

Cut the link for 10 seconds

280 QPS

Numbers from Bronson et al., HotOS 2021, §2.1: capacity 300 QPS, a 1 s client timeout, one retry, 280 QPS, a 10 s outage whose held requests arrive when the link returns. Simulated here as a fluid queue (FIFO, 0.1 s steps, at most 6,000 queued); a per-request simulation with random arrivals agrees on every outcome. Chapters 3 to 5 work each number.

Chapter 0

Three Replicas, One Bug

Give a service three copies, then watch one shared cause take all three down at once

A web service runs on three servers behind a load balancer. At 3:17 one server fills its disk: a logging library writes a stack trace in a loop. The balancer moves its traffic to the other two. Ninety seconds later, both are down too.

Nothing physical broke. The same library runs on all three servers, and the same odd input still arrives. The three copies were redundant against a dead disk, not against a shared bug. A fault is one part that stops doing its job. A failure is when users see the service stop. Redundancy turns a fault into no failure only when the copies fail for different reasons.

How much does a shared cause cost? Call the share of time one replica is down p, and the number of replicas n. Call the share of p that comes from a cause all replicas share β (beta): the same bug, the same config, the same power feed. The chance that all n are down at once is Pall.

Say it aloud

P-all is about beta times p, plus, one minus beta times p, to the power n.

Pall
P-all the chance that every replica is down at the same moment, so users see a failure.
β
beta the share of a replica's downtime that comes from a cause every replica shares. Between 0 and 1.
p
p the share of time one replica is down: 1% here, illustrative.
n
n the number of replicas: 3 here. Only the independent part has this power.
In plain words

The shared part, beta times p, takes all n replicas down together, so it counts once. The independent part, one minus beta times p, must strike every replica separately, so you multiply it n times. Add the two.

With numbers

With made-up numbers: p = 0.01, n = 3. With no shared cause, Pall = 0.013 = 0.000001, one hour in a million. With β = 0.1, Pall = 0.001 + 0.0093 = 0.001, a thousand times worse. The shared tenth of the downtime decides everything.

Add replicas against a shared cause

Orange boxes are replicas; red marks are hours each one was down. The bars, on a log scale, show the chance that all are down at once. Add replicas, then raise the shared share β.

3
10%

Simulated: 2,000,000 hours, one seed; each replica is down 1% of hours. A shared event (chance βp each hour) takes all down; the rest strikes each replica on its own. Illustrative rates, not measurements.

Every chapter that follows is one way a fault spreads past the copies meant to absorb it, or one wall that stops it. The measure that ties them together is the blast radius: the share of users or requests one fault reaches.

Failure. Symptom: three replicas, and all three crash within two minutes. Measure: how many replicas fail in the same window, and what they share. Cause: one bug, one config or one input reaches every copy. Fix: roll changes out to one group at a time, and keep copies apart in what they share.

  1. MTBF: failure as a rate, and why repair time matters as much.
  2. Config: bugs, pushes and leaks that reach every copy.
  3. Cascade: survivors inherit the load, and queues explode.
  4. Retries: every layer multiplies the work.
  5. Metastable: the hero's trap, stuck after the trigger is gone.
  6. Gray: healthy to the checker, broken to the user.
  7. Domains: spare capacity, spread across racks and zones.
  8. Sharding: shuffle shards and cells shrink the blast radius.
  9. Showcase: a fleet you can break four ways.
  10. The field guide: numbers, incidents, code and links.
Ten servers run the same binary. A rare request crashes server 1. What happens next?

Chapter 1

Failure Is a Rate

Count failures across a fleet, then see that repair time sets availability as much as the failure rate does

A disk wears out. A power supply capacitor dries. These hardware faults are mostly independent: one disk dying does not make the next one die. So one spare defeats them. But at scale they never stop.

Vendors quote the annual failure rate (AFR), the share of units that fail in a year. Take 10,000 servers with 4 disks each and an AFR of 2% (illustrative). That is 40,000 × 0.02 = 800 disk failures a year, or 2.2 a day. The chance of a week with no failure is (1 − 0.02/52)40,000 = 2 in 10 million. A large fleet repairs disks every day, as routine work.

Two numbers describe one part. The mean time between failures (MTBF) is how long it runs, on average, before it fails. The mean time to repair (MTTR) is how long it stays down each time. Call the share of time the part is up its availability, A.

Say it aloud

A equals M-T-B-F over, M-T-B-F plus M-T-T-R.

A
A availability: the share of time the part is up, from 0 to 1.
MTBF
M-T-B-F mean time between failures: the average up stretch, in hours. 2 years = 17,520 h here, illustrative.
MTTR
M-T-T-R mean time to repair: the average down stretch, in hours. 24 h here.
In plain words

One cycle is an up stretch of MTBF hours and a down stretch of MTTR hours. A is the up part over the whole cycle. Halving MTTR helps almost as much as doubling MTBF.

With numbers

With made-up numbers: MTBF = 17,520 h, MTTR = 24 h. A = 17,520 / 17,544 = 0.99863, about 12 hours down a year. Repair in 12 h instead and A = 0.99932: 6 hours a year. Two independent copies are both down a share (1 − A)2: about 1 minute a year.

Run five years of failures

Each bar is one copy over five years: green up, red down (drawn at least 2 pixels wide so you can see them). The last bar marks hours when both copies were down. Drag the two times.

2 years
24 h

Simulated: up and down stretches drawn at random (exponential) around the means; the numbers in the read-out use 20,000 pairs of copies over 5 years, one seed. Illustrative times.

Failure rates also change with age, in a bathtub curve. There are more failures in the first weeks (factory defects), few for years, then more as parts wear out. Disks bought in one batch and installed on one day can wear out together, which makes them less independent than the formula assumes.

Failure. Symptom: a second disk in the same array fails while the first is still rebuilding. Measure: the rebuild time, and the age and batch of the disks. Cause: a long MTTR leaves a window for the second fault, and one batch shares its wear. Fix: faster rebuilds, and mixed batches across copies.

A server has MTBF 17,520 h. Which change raises its availability more: doubling MTBF, or cutting MTTR from 24 h to 12 h?

Chapter 2

The Same Bug Everywhere

Ship one change to every server at once, then watch bugs, pushes and leaks strike all copies together

Software faults are the opposite of disk faults. Every replica runs the same code, so a bug waits on every replica for the same trigger. A poison pill is a request that crashes any server that handles it. If the client retries 3 times, one request crashes 4 servers, one after another.

Configuration is worse, because a config change often skips the slow rollout that code gets. On 2 July 2019, Cloudflare pushed one firewall rule with a badly written regular expression to every server at once. It used up the CPU that serves web traffic, and the outage lasted 27 minutes. On 28 February 2017, one mistyped input to an S3 maintenance command removed more servers than intended in AWS us-east-1. Both changes reached the whole fleet before anyone saw the effect.

A resource leak is a slow shared cause. A process takes memory and never gives it back. Take a process that starts at 2 GB and leaks 50 MB an hour; the system kills it at 8 GB (decimal units, illustrative). It crashes after (8,000 − 2,000) / 50 = 120 hours: 5 days. Servers deployed in the same hour crash in the same hours.

Watch a leak crash the fleet

Each purple bar is one server's memory; it crashes at the yellow 8 GB line and restarts at 2 GB after 15 minutes. The lower chart counts servers down at once. Switch to staggered starts, and drag the leak rate.

50 MB/h

Illustrative: 20 servers running the same code on the same traffic, so each leak rate is within ±1% of the slider; one seed. Staggered servers start with memory spread evenly from 2 to 8 GB, as if started at different times. Simulated minute by minute for 7 days.

The fix for all three is the same idea: never let one change, or one clock, reach every copy at once. Roll code and config out to a small group first, and watch it. Spread restarts so leaks do not line up. Testing & Deployment covers canaries and staged rollouts in depth.

Failure. Symptom: every server fails within the same few minutes, with healthy hardware. Measure: what changed in the last hour, and on how many servers. Cause: a code, config or data change reached the whole fleet together. Fix: staged rollout of every change, config included, with automatic rollback.

A config that sets the connection pool size to 0 goes to all 20 servers at once. How many fail?

Chapter 3

Survivors Inherit the Load

Remove one server from a busy pool, then watch the queue wait of the survivors explode

Ten servers share one queue. Each finishes 100 requests a second, and 800 arrive each second. The pool is 80% busy. One server dies. The same 800 requests now go to nine servers, which are 89% busy. Lose two, and eight servers face exactly their capacity.

Wait time does not grow in step with load. Requests arrive at random, so they bunch up, and a request waits whenever every server is busy. The chance of that is the Erlang C probability, C. Load Balancing derives it. Call the arrival rate λ (lambda), the rate one server finishes requests μ (mu), and the servers still alive c. The mean wait in the queue is Wq.

Say it aloud

W-q equals C over, c times mu minus lambda.

Wq
W-q the mean time a request waits in the queue before a server starts on it.
C
C the Erlang C probability: the chance an arriving request finds all c servers busy.
c
c the servers still alive and sharing the queue: 10, then 9.
μ
mu requests one server finishes per second: 100 here, illustrative.
λ
lambda requests arriving per second: 800 here.
In plain words

c times mu is what the pool can finish; take away lambda, and the rest is spare capacity. The wait is the chance of finding everyone busy, divided by that spare. As spare capacity falls to zero, W-q grows without limit.

With numbers

With made-up numbers: c = 10, μ = 100, λ = 800 gives C = 0.409 and Wq = 0.409 / 200 = 2.0 ms. With c = 9, C = 0.653 and Wq = 0.653 / 100 = 6.5 ms. One server lost, three times the wait. With c = 8 the spare is zero, and the queue never drains.

Kill servers in a busy pool

Orange boxes are servers; a red cross is a dead one. The curve is the Erlang C wait for each number of live servers, on a log scale; the blue dot is a simulation of 100,000 requests. Kill servers, then drag the load.

800/s

Simulated: random (Poisson) arrivals, random (exponential) service at 100/s per server, one shared queue, 100,000 requests, one seed. Illustrative rates.

Overload then spreads by itself. Slow servers fail their health checks, and the balancer removes them, so the rest get even more load. The Google SRE book names this: "A cascading failure is a failure that grows over time as a result of positive feedback." A server with a long queue also uses more memory per waiting request, until it crashes.

Failure. Symptom: one server dies, and twenty minutes later the whole pool is down. Measure: utilisation of the survivors after one loss, and health-check failures over time. Cause: no spare capacity for a lost server, so each loss overloads the rest. Fix: keep utilisation low enough that the pool survives a loss, and shed excess load (Resiliency Patterns).

Four servers run at 75% each. One fails, and nothing is retried. How busy are the other three?

Chapter 4

Every Layer Multiplies

Let each layer retry a failed call, then count the attempts that reach the database for one click

A retry hides a short glitch: the call fails, you try again, and it works. That is why every client library retries. The trouble starts when the failure is overload. Then each retry is more work for a server that is already too busy.

Start with one caller. Call the chance that one attempt fails f, and the most retries the caller makes r. The caller tries again only after a failure, so the second attempt happens with chance f, the third with chance f squared, and so on. Call the average number of attempts per request a.

Say it aloud

a equals one, plus f, plus f squared, and so on, up to f to the r.

a
a the average number of attempts one request sends to the layer below.
f
f the chance that one attempt fails, from 0 to 1.
r
r the most retries allowed, so at most r + 1 attempts: 3 here.
In plain words

The first attempt always happens. Each later attempt happens only if all the attempts before it failed, which has chance f times itself. Add those chances, up to the r-th retry. When f is near 1, a is r + 1.

With numbers

With made-up numbers, r = 3. At f = 0.1, a = 1 + 0.1 + 0.01 + 0.001 = 1.11: retries add 11%. At f = 0.5, a = 1.875. At f = 1, a = 4. A healthy server sees almost no retries; a dying one sees four times its load.

Now stack layers. Say the browser, the frontend and the backend each make 3 retries, and the database fails every call. One click then makes 4 × 4 × 4 = 64 attempts on the database. That is the Google SRE book's own example.

Count the attempts for one click

Each row is a layer, from the click at the top to the database at the bottom. Blue dots are attempts that reach that layer for one click, on average. Start at 64, then lower the failure rate and remove layers.

3
3
100%

Expected values from the formula, layer by layer: a layer's call fails only if all its attempts failed. Checked against 20,000 simulated clicks, one seed. Each database attempt fails with chance f, independently; real overload makes f rise with load, which is worse.

Failure. Symptom: the database gets many times its normal traffic during an incident, though users send no more. Measure: attempts per user request at each layer. Cause: retries at several layers multiply. Fix: retry at one layer only, cap retries with a budget, and add backoff with jitter (Resiliency Patterns).

Two layers each make 2 retries. The database fails every call. How many database attempts does one click make?

Chapter 5

Stuck After the Trigger Is Gone

Push a healthy service over the edge for ten seconds, then find the load it must drop to before it comes back

Back to the hero: capacity 300 queries a second (QPS), load 280, a 1-second timeout, one retry. After the 10-second cut, the held queries arrive at once and the queue passes 1 second.

Now every answer comes back after its client gave up, and every client retries. The database gets 560 QPS, so the queue never drains.

Bronson and co-authors (HotOS 2021) call this a metastable failure: a trigger moves the system into a bad state that stays after the trigger ends. There goodput, the rate of useful answers, is near zero. A sustaining effect, here the retries, holds it there, and it is the real root cause.

When can a trigger stick? In the bad state almost every attempt times out, so each query arrives r + 1 times. Call the fresh query rate λ, the capacity μ and the retries r. The system recovers from any trigger only while:

Say it aloud

Lambda is less than mu over, one plus r.

λ
lambda fresh queries per second from users: 280 in the paper's example.
μ
mu queries per second the database can finish: 300.
r
r retries per query: 1 in the paper. In the bad state each query costs 1 + r attempts.
In plain words

In the bad state, the load is lambda times one plus r. If that is below mu, the queue drains and the system climbs out. If it is above mu, the retries alone keep the queue full. Below the bound is stable; between the bound and mu is vulnerable: healthy until a trigger.

With numbers

The paper's numbers: μ = 300, r = 1. The bound is 300 / 2 = 150 QPS, so at 280 QPS the service is vulnerable. To recover, cut the load below 150 QPS, or cut the retries below 300 − 280 = 20 QPS. With r = 3 the bound falls to 75 QPS.

Fire a trigger, then climb out

The teal line is goodput when healthy; the red line is goodput when stuck. The dot is the service now. Fire the trigger, then drag the load down until the dot jumps back.

280 QPS

Every move runs the hero's fluid queue (capacity 300 QPS, 1 s timeout) for 400 simulated seconds from the current state; the dot shows the goodput it settles at. Shape after Bronson et al. 2021, Figure 2; the curve is this simulation, not the paper's plot.

The paper notes that many systems run in the vulnerable state on purpose, because it uses hardware well.

Failure. Symptom: the outage started with a network blip, the network is fine now, and the service is still down. Measure: goodput against attempts, and the share of work done on requests whose clients already left. Cause: a sustaining effect, here retries. Fix: shed load or switch retries off to escape; drop requests that are already past their timeout, so the server does no wasted work.

Capacity 300 QPS, 3 retries per query. Below what load does every trigger heal by itself?

Chapter 6

Healthy to the Checker, Broken to the User

Let one switch drop packets while it still answers heartbeats, then see how fan-out spreads it to nearly every request

Chapters 0 to 5 assumed a broken part looks broken. Many do not. A server's request handler is stuck, but its heartbeat thread still answers. A link runs at a tenth of its speed, but a connectivity test passes. The checker says healthy, so nothing replaces the part.

Huang and co-authors at Microsoft (HotOS 2017) call this gray failure. Its mark is differential observability: an app sees the system as unhealthy while the system's own failure detector sees it as healthy. Failure Detection & Time builds the detectors; this chapter shows what they miss.

The paper's example is a data centre network with n core switches. A frontend fans each request out to m backends, and waits for nearly all. Each backend call crosses one core switch at random. Call the chance that a request touches one given switch Phit.

Say it aloud

P-hit equals one minus, n minus one over n, to the power m.

Phit
P-hit the chance that one request crosses the gray switch at least once.
n
n the number of core switches: 8 here, illustrative.
m
m the fan-out: backend calls per request, each on a random switch.
In plain words

One call misses the gray switch with chance n minus one over n. All m calls miss it with that chance multiplied m times. One minus that is the chance the request touches it at least once.

With numbers

With made-up numbers: n = 8. At m = 1, Phit = 1/8 = 12.5%. At m = 10, 1 − 0.87510 = 74%. At m = 40, 99.5%. One quiet switch slows almost every request, and adding switches adds more places for a gray failure.

Hide a bad switch from the checker

Orange boxes are core switches; the dashed one drops packets but its heartbeat says OK. Blue lines are one request's backend calls; red ones crossed the bad switch. Raise the fan-out, then turn on an app-level check.

8
10

Simulated: 20,000 requests, one seed, each backend call on a uniformly random switch. The app-level check removes the gray switch from routing once its call error rate stands out. Illustrative network, after Huang et al. 2017, §2.1.

Failure. Symptom: users report slow pages, and every dashboard is green. Measure: errors and latency seen by the callers, split by which server or switch served the call. Cause: the health check tests a different path from real requests. Fix: judge health by what clients see, with several signals, and remove outliers.

A request fans out to 20 backends over 20 switches, one of which drops packets silently. About what share of requests touch it?

Chapter 7

Spread the Spares

Place three replicas on racks and zones, fail each level, and size the spare capacity a lost zone needs

Redundancy comes in two forms. In active-passive, one copy serves and a standby waits; a failover promotes the standby when the primary dies. In active-active, every copy serves all the time, and the balancer stops sending to a dead one. Active-active has no failover step, and its spares are warm because they serve real traffic.

A standby that never served is a risk. Its cache is empty, so its first minutes after failover are slow, and that slowness can start Chapter 3's cascade. With asynchronous replication, it may also lack the last seconds of writes: a standby 30 seconds behind loses 30 seconds of acknowledged writes.

Copies also need to fail for different reasons. A fault domain is a group of parts that share one point of failure. Examples: a server, a rack with one switch, an availability zone (AZ) with its own power and cooling, a region. Put three replicas on one rack, and one switch takes all three.

Fail a rack, then a zone

Three zones, three racks each, three servers per rack. Purple dots are the three replicas of one database. Pick a placement, then fail a server, a rack or a zone. Two of three replicas keep a majority.

Illustrative layout. Each failure hits the part holding the first replica, the worst case for that placement.

Surviving a zone also costs capacity. Call the servers needed at peak Nneed, the number of zones Z, and the servers to buy Ntotal. After a zone fails, the other Z − 1 zones must carry the whole peak.

Say it aloud

N-total equals N-need times Z over, Z minus one.

Ntotal
N-total the servers to run, spread evenly over the zones.
Nneed
N-need the servers the peak load needs: 6 here, illustrative.
Z
Z the number of zones. Z minus one zones are left after one fails.
In plain words

The Z minus one surviving zones must hold N-need servers between them. So each zone needs N-need over Z minus one, and you run that in all Z zones.

With numbers

With made-up numbers: Nneed = 6. With 3 zones, Ntotal = 6 × 3/2 = 9: 3 per zone. With 2 zones, 12: double. With 4 zones, 8. More zones need less spare, but each costs network fees and latency.

Failure. Symptom: a zone goes down, the other zones accept its traffic, then they fall over too. Measure: peak utilisation if any one zone disappears. Cause: replicas spread across zones, but capacity not sized for a lost zone. Fix: run Nneed · Z / (Z − 1), and test a zone loss on purpose.

Three database replicas sit in three zones. Zone 1 loses power. What is left?

Chapter 8

Shrink the Blast Radius

Give each customer a random pair of workers, then count how few others one bad customer can reach

A service has 8 workers and many customers. If every customer can reach every worker, one customer's poison request, retried, crashes all 8 workers. Everyone is down. Split the workers into 4 fixed shards of 2, and a bad customer takes out one shard: a quarter of the customers.

Shuffle sharding gives each customer its own random set of k workers. Two customers rarely get the same set, so a bad customer's crash leaves almost everyone else with at least one live worker. Colm MacCárthaigh describes it in the AWS Builders' Library. Call the number of workers n, the shard size k, and the chance that another customer has exactly the same shard Psame.

Say it aloud

P-same equals one over, n choose k.

Psame
P-same the chance that another customer was dealt exactly the same workers, so it goes down too.
C(n, k)
n choose k the number of different sets of k workers you can pick from n: n! / (k! (n − k)!).
n
n the workers: 8 here.
k
k the workers in each customer's shard: 2 here.
In plain words

Count the ways to deal k workers out of n. Each customer gets one of those sets at random. The chance that two customers got the same set is one over that count.

With numbers

AWS's numbers: n = 8, k = 2 gives C = 28, so Psame = 1/28 = 3.6% of customers go down with the bad one, against 25% with fixed shards. Route 53 uses 2,048 virtual name servers and 4 per domain: C(2048, 4) = 730 billion shards.

Let one customer crash its workers

Orange boxes are workers; small dots are customers. Purple lines show customer A's shard. Crash A's workers: red customers lost every worker, pink ones lost some. Try all three layouts.

Simulated: 200 customers dealt at random with one seed per deal; the read-out also averages 20,000 customers. A customer is down when all its workers are down. The 8-worker example follows the AWS Builders' Library article.

Shuffle sharding cannot stop a fault that reaches every worker, such as a bad deploy. A cell can. A cell-based architecture runs many full, independent copies of the service, each with its own servers, data and deploys. A thin router sends each customer to one cell. A bad deploy goes to one cell first, so it reaches 1 customer in 10 with 10 cells. AWS writes that its teams have built this way "for more than a decade".

Failure. Symptom: one tenant's bad traffic slows every tenant. Measure: which tenants share each server, and how many lose all their servers when one tenant's servers fail. Cause: every tenant can reach every server. Fix: shuffle shards for tenant faults, cells for deploy and config faults.

20 workers, shards of 2. What is the chance that another customer has exactly your shard?

Chapter 9

Break the Fleet

Stack the walls you choose, then fail a server, a rack, a config push and a tenant, and read the blast radius

Here is a fleet of 32 servers on 4 racks, serving 1,000 customers. Each wall from this lesson is a switch. Spread puts every customer's servers on several racks (Chapter 7). Shuffle shards gives each customer 4 random servers instead of the whole pool (Chapter 8). Cells splits the fleet into 4 cells of 8, each with its own deploys.

A customer is down when every server it uses is down. A rack failure takes 8 servers. A bad config push reaches every server in its deploy unit: the fleet, or one cell. A poison tenant crashes every server it can reach, because its retries find them all. Predict each number before you press.

Inject a failure, read the blast radius

Columns are racks and boxes are servers; with Cells on, each box shows its cell. Each dot stands for 5 customers (one in five is drawn): red is down, pink lost some servers. Switch walls on, then inject.

Simulated: 1,000 customers placed with one seed. Without spread, a shuffle shard or a cell sits on one rack. Capacity is not modelled: the toy lets survivors carry the load (Chapters 3 and 7 say when they cannot).

No single wall stops all four. Spread stops the rack. Shuffle shards stop the poison tenant but not the config push. Cells stop the push and limit the tenant to one cell. Turn all three on: the worst case is about a quarter of customers (23.5%) on a bad push, and almost no one on everything else.

Chapter 10

The Field Guide

Keep the numbers, the incidents and the code for the next postmortem you read

Faults are certain; outages come from faults that spread. They spread through shared causes (one bug, one push), through load (survivors inherit it, retries multiply it), through loops that outlive their trigger, and past checkers that test the wrong path. Spare capacity, staged changes and walls between customers keep each fault small.

Terms and numbers

TermWhat it isThis lesson's number
Shared causePall ≈ βp + ((1 − β)p)np 1%, n 3: 10−6 alone, 10−3 with β 10%
AvailabilityA = MTBF / (MTBF + MTTR)17,520 h and 24 h: 0.99863
Fleet failuresunits × AFR40,000 disks at 2%: 800 a year
Queue waitWq = C / (cμ − λ)10 servers 2.0 ms; 9 servers 6.5 ms
Retry attemptsa = 1 + f + … + fr3 layers, 3 retries, all fail: 64
Metastable boundλ < μ / (1 + r)300 QPS, 1 retry: 150 QPS
Gray failure reach1 − ((n − 1)/n)m8 switches, fan-out 10: 74%
Zone spareNneed · Z / (Z − 1)6 needed, 3 zones: 9
Shuffle shardPsame = 1 / C(n, k)8 and 2: 1/28; Route 53: 1 in 730 billion

Public postmortems, read for blast radius

IncidentWhat spread itWall that limits it
AWS S3, 28 Feb 2017a mistyped input to a maintenance command removed more servers than intended in us-east-1limits on how much one command can remove; smaller cells
Google Cloud, 2 Jun 2019two misconfigurations and a bug in maintenance software that could deschedule several independent clusters at oncenever act on several fault domains together
Cloudflare, 2 Jul 2019a firewall rule with a costly regular expression, pushed to every server at once; 27 minutesstaged rollout for rules and config
Facebook, 4 Oct 2021a command meant to assess backbone capacity took the backbone down; a bug in the audit tool failed to stop it; DNS servers then withdrew their routeschecks that nothing can bypass; keep recovery tools off the failed path

The core as code

python# the metastable bound, checked by a fluid queue (the hero's model, simplified)
def goodput_after_cut(lam, r, mu=300, T=1.0, dt=0.1, cut=(20, 30), end=400):
    q = []                                   # FIFO of [born, count, attempt, timed_out]
    good = 0.0
    for i in range(int(end / dt)):
        t = i * dt
        q.append([t, lam * dt, 0, False])
        for c in q:                         # the client gives up at T and retries
            if not c[3] and t - c[0] >= T:
                c[3] = True
                if c[2] < r: q.append([t, c[1], c[2] + 1, False])
        budget = 0 if cut[0] <= t < cut[1] else mu * dt
        good = 0.0
        while budget > 0 and q:                # the server works FIFO, stale or not
            take = min(budget, q[0][1]); q[0][1] -= take; budget -= take
            if t - q[0][0] < T: good += take / dt   # useful only if the client still waits
            if q[0][1] <= 0: q.pop(0)
        q = [c for c in q if c[1] > 0 or not c[3]]
    return good

for lam, r in [(280, 1), (100, 1), (140, 1), (200, 0)]:
    print(lam, r, round(goodput_after_cut(lam, r)))   # 0, 100, 140, 200: stuck only above 300/(1+r)

Keep going

The takeaway. Ask of every part: what does it share with its copies, how much load lands on the survivors, what multiplies when it fails, and would the checker notice? A fault you can contain is routine. A fault that spreads is an outage.

Now press Present or Teach and explain four things from memory. Explain why a 10% shared cause makes three replicas a thousand times less safe. Explain why nine servers at 89% wait three times as long as ten at 80%. Explain why one retry traps a database at 280 QPS when it heals at 140. Explain why shuffle shards stop a poison tenant but not a bad push. Then go back to the hero, pick 1 retry, and drag the load from 280 down to 140.

Failure Modes & Isolation
Metastable Failures · Gray Failure · Addressing Cascading Failures · Back to Gleams