CASCADING FAILURES

One node dies, the survivors inherit its load, then they die

L318 MINRELIABILITY
PREDICT

Three replicas sit behind a load balancer that evicts any replica failing its health check. Each can serve 100 req/s and runs at 70%. None ever refuses work: they queue everything, no shedding. One crashes. Which of these is true 60 seconds later?

Three replicas each serve 100 req/s and run at 70%. One crashes. The balancer spreads 210 req/s across the two survivors: 105 req/s each. A 5% overload does not look dangerous, but each survivor’s queue grows 5 requests every second and never shrinks. The health check waits in that same queue. After 20 s it waits more than its 1 s timeout; two misses and the balancer evicts the replica. The last one gets 210 req/s and fails within seconds. One crash becomes three.

The fix is shedding at each replica: serve 100 req/s, answer 503 at once to the rest. The queue stays short, the health check keeps passing, and the cluster serves 200 of 210 req/s instead of 0. Headroom helps too: N replicas survive one loss only if utilisation is below (N-1)/N.

▶ SIMULATION
LOAD BALANCER
t = 0 s
demand: 0 req/s (3 × 70% × 100)
healthy: 3 of 3 → 70 req/s each
replicas queue everything · health check every 5 s, evict after 2 failures
R1 — healthy
load: 0 req/s of 100
queue: 0 (0 s)
health checks failed: 0 / 2
serves 0 req/s in time
R2 — healthy
load: 0 req/s of 100
queue: 0 (0 s)
health checks failed: 0 / 2
serves 0 req/s in time
R3 — healthy
load: 0 req/s of 100
queue: 0 (0 s)
health checks failed: 0 / 2
serves 0 req/s in time
served in time (last second)0 of 210 req/s
✓ at least one replica stays healthy✓ requests served in time >= 80% of demand
SCHEDULE
01[BALANCER]traffic starts: REPLICAS × UTILISATION % × 100 req/s, spread evenly
02[CLOCK]+5 s
03[CLOCK]+5 s
04[CLOCK]+5 s
05[CLOCK]+5 s
06[CLOCK]+5 s
07[CLOCK]+5 s
08[CLOCK]+5 s
09[CLOCK]+5 s
10[CLOCK]+5 s
11[CLOCK]+5 s
12[CLOCK]end of window: report
Start of steady state scenario. 12 steps.
// Each replica accepts whatever the balancer sends.
app.use((req, res, next) => next());
app.get('/health', (req, res) => res.send('ok'));   // waits in the same queue as everything else
// One crash → survivors at 105% → queues grow → /health times out → evicted → the rest get 210%

Watch the invariant strip in ONE DIES, NO SHEDDING: both invariants hold for 28 seconds after the crash while the queues grow, then both go red in one step. In FIX: SHED AT EACH REPLICA the same crash happens and both stay green: 2 of 3 replicas healthy, 200 of 210 req/s served. Then raise REPLICAS to 4 and watch the cascade not happen at all.

INJECT A FAULT NOT YET

Three replicas at 70% each, no shedding. Crash one replica and find a position where the whole cluster is down by the end of the window.

GOAL: no healthy replica is left at the end of the window

FIX IT NOT YET

Three replicas, 100 req/s each, 210 req/s of demand. R1 crashes at t = 2 s. Rewrite routeAndServe so each replica accepts only what it can serve and the cluster never collapses. A replica whose queue is deeper than 1 s of work fails its health check; two in a row and it is evicted.

Mental model:

A cascade is positive feedback: load that one node cannot carry moves to the others, which makes them unable to carry theirs. Every mechanism that removes a slow node (health checks, circuit breakers, client retries) feeds the loop unless each node can refuse work it cannot do. So a replica must shed above its capacity, the cluster must keep headroom for the loss of one, and recovery often means cutting inbound load first, because new capacity added mid-cascade is eaten the moment it comes up.

IN PRODUCTION

Any replicated service behind a balancer with health checks: Kubernetes readiness probes evicting overloaded pods, database connection storms after a primary failover, cache fleets where one node's loss sends its keys to the rest, retry storms that turn one slow dependency into a fleet-wide outage. The telltale shape is a staircase of unhealthy nodes, each step faster than the last.

IN INTERVIEWS

“One of your replicas died and the rest followed. Walk me through it.” Describe the redistribution, the queue growth, the health check timing out inside that queue, and the eviction loop. Then give the three fixes: shed per replica, keep headroom below (N-1)/N, and during recovery cut load at the edge before adding capacity.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.

USED IN

Chapters that build on this lesson.

NEXT: GRACEFUL DEGRADATION →