Unit 6 of 15 · about 4 hours · explain, implement
Retry budgets, circuit breaking, cascading and correlated failure and chaos scenarios
Retries are load, and load is what the overloaded dependency cannot take. Unbudgeted retries plus a shared fate across callers is how one slow service stops them all.
You'll be able to
- Derive worst-case retry amplification across dependency layers and cap it with a budget.
- Implement circuit breaking with half-open probing and bulkhead isolation.
- Distinguish trigger from sustaining cause in a metastable outage and name the chaos scenarios that reproduce each.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Cascading failures: overload, retries, deadlinesGoogle SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and Recovery
Server Overload; Queue Management; Load Shedding and Graceful Degradation; Retries; Latency and Deadlines (Picking a deadline, Deadline propagation, Bimodal latency); Testing for Cascading Failures
- Resilience: timeouts, retries, breakers, bulkheads, jitterHLD Handbook - Reliability, Operations and Security at Scale
The cascading failure story; Timeouts; Retries; Circuit breakers; Bulkheads; No jitter versus Full Jitter versus Equal Jitter versus Decorrelated Jitter
- Metastable failures: trigger and sustaining effectMetastable Failures in Distributed Systems (Bronson et al., 2021)
The metastable pattern (vulnerable state, trigger, sustaining effect); Section 2.1 and Figure 2: a 10-second network outage triggers retry amplification while normal offered load is 280 QPS, and retries sustain 560 QPS after connectivity returns; retry storms and cache-miss avalanches as sustaining effects
Read as incident vocabulary and design prompts (retry budgets, shedding). The 7-page toy model illustrates; it does not predict.
- Metastable failures in the wild: incident evidenceMetastable Failures in the Wild (Huang et al., 2022)
Section 1 (22 metastable failures from 11 organizations); Table 1 public-source incident rows; Section 2.2 (retry policies as the most common sustaining effect, in more than half the studied incidents)
Read as a trigger catalog for chaos scenarios. The sample is public reports, not a failure rate; never quote the retry share as universal.
Focus on
- Amplification multiplies down the stack. One retry at each of four layers turns one user call into attempts; the budget caps attempts, not intentions.
- Equal jitter spreads synchronized retries: for attempts numbered from zero,
temp = min(cap, base * 2**attempt)and each sleep istemp / 2plus a uniform draw from0totemp / 2, with an independent RNG per client. - The breaker in the exercise uses timeouts as the probe timer, not as failures: a timeout moves open to half-open, and one trial decides.
- Removing the trigger does not end a metastable outage. In the worked example the network recovers but the retry loop keeps load high; only dropping offered load below the model's stable threshold recovers it, and that toy threshold is not a production target.
Common mistakes · 3
- Counting retries per layer instead of multiplying. 2 retries at each of three layers is downstream attempts in the Systems unit's example, not 6.
- Treating breaker timeouts as failures. In the simulator a timeout leaves closed-state counts unchanged and only advances open toward half-open.
- Confusing trigger with root cause. The incident study separates what pushed the system into the vulnerable state from the retry loop that held it there.
Try it yourself
Closed-book, before checking anything
random.Random(7)).Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.One retry is configured at each of 4 layers. How many attempts can one user call produce?Answer
. Each layer doubles the attempts of the layer above, so budgets must be set against the product.
2.Equal jitter, base 1 s, cap 8 s, seed 7: what are the first three sleeps?Answer
About 0.66 s, 1.15 s and 3.30 s. Each is
temp/2plus a uniform draw up totemp/2withtemp1, 2 and 4.3.Events
failure, failure, timeout, successwith threshold 2: what states does the breaker report?Answerclosed, open, half_open, closed. The second failure opens it, the timeout starts one trial, and the successful trial closes it.4.A message fails 3 times with
maxRetries = 2. Delivered or dead-lettered?AnswerDead-lettered. Delivery needs failures at or below the budget; exactly at the budget still delivers, one more does not.
5.Load returns to normal but the outage persists. What does the metastable model say to do?Answer
Break the sustaining loop: shed load, drain the retry backlog, restore cache hit rate. Waiting for the trigger to pass already failed.
Practice
- AlgoMaster: Classify Retry Outcomes
classifyreturnsdeliveredfor failures within budget anddlqbeyond it, preserving order without mutating input - AlgoMaster: Simulate a Circuit Breaker
simulatereports the state after every event; the page tests threshold opening, timeout-driven half-open trials and trial-failure reopening
You're done when
Your amplification product, jitter schedule and breaker trace match hand computation, and your loglab retry policy states its budget as a share of traffic.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 13 more in the section
- HLD Handbook - Reliability, Operations and Security at ScaleHLD Handbook · primary
Read Part 6 observability, SLOs, resilience, overload, deployments, chaos, incidents and health, then Part 7 authentication, mTLS, secrets, tenancy and data governance chapters relevant to the capstone. Skip unrelated case studies.
- Google SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and RecoveryGoogle · required
Read SRE Chapter 4 (service level objectives), 6 (monitoring distributed systems), 21 (handling overload), 22 (addressing cascading failures), 14 (managing incidents) and 15 (postmortem culture); Workbook Chapter 2 (implementing SLOs) and 5 (alerting on SLOs); and Building Secure and Reliable Systems Chapter 5 (least privilege) and 9 (design for recovery). Convert each into one alert, limit, load test or runbook action in the capstone.
- Metastable Failures in Distributed Systems (Bronson et al., 2021)HotOS · support
Read the trigger and sustaining-effect model of metastable failure and the retry and shedding design prompts. Its model illustrates; it does not predict.
- Metastable Failures in the Wild (Huang et al., 2022)USENIX OSDI · support
Read the incident study for how retries and load sustain outages after the trigger ends; it is a sample of public reports, not a rate.
Also in this section
- DDIA 2e - Chapters 2, 5 and 14Martin Kleppmann and Chris Riccomini · support
Use Chapter 2 "Describing Performance" for percentile and response-time vocabulary and Chapter 5 for compatibility during rolling upgrades. Chapter 14 is about predictive analytics, privacy and data governance, not operations: read its "Privacy and Tracking" section for the retention and deletion units.
- Simple Testing Can Prevent Most Critical Failures (Yuan et al., 2014)USENIX OSDI · support
Read the findings on error-handling code and how few nodes and events reproduce most failures, as the case for testing error paths in your campaign. Its bounds come from one sample of 2014 systems.
- Gray Failure: The Achilles' Heel of Cloud-Scale Systems (Huang et al., 2017)Microsoft Research · support
Read the gray-failure model (differential observability between a detector and its clients) as vocabulary for telemetry and failure detection.
- The Internals of PostgreSQL - Base Backup and Point-in-Time RecoveryHironobu Suzuki · support
Read Chapter 10 (base backup, how PITR replays WAL, timelines and incremental backup) as the real-engine model for backup integrity, recovery points and restore verification. Note the date you read it.
- Building Distributed Systems - The Tracer, The Securitor and The MigratorBuild Distributed Systems · optional
Only the first three tasks of each track are free: in The Tracer, trace-context propagation, span lifecycle and a collector; in The Securitor, JWTs, the OAuth 2 code flow with PKCE and sessions; in The Migrator, schema migrations, expand and contract, and zero-downtime change. Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- SPIFFE Workload Identity and Workload APISPIFFE Project · support
Read the SPIFFE ID, X.509-SVID and trust bundle specifications and the Workload API (
FetchX509SVID,FetchX509Bundles) to design service identity, short-lived credentials and bundle rotation. A local mock is sufficient unless a real SPIRE deployment answers a specific gap. - OpenTelemetry Signals and Semantic ConventionsOpenTelemetry · support
Read signals and context propagation (W3C Trace Context
traceparent, inject and extract, baggage rules), then the semantic conventions (1.44.0) for the RPC and messaging areas with their stability status. Define bounded attributes for request, node, partition, term and offset identities, and never infer global order from display timestamps. - Replicated Log and Stream Processor - Production ContractRoadmap-Final · support
Add workload identity, tenant checks, audit, SLOs, capacity limits, backup and verified restore, mixed-version migration, rollback and reduced point-in-time ML data paths. Run one compound incident from detection through recovery.
- OWASP Threat Modeling Cheat SheetOWASP · reference
Use System Modeling (data-flow diagrams, trust boundaries, stores and processes), Threat Identification (the STRIDE table applied to components, data flows and trust boundaries) and Response and Mitigations to build the unit threat model.
- Feast Documentation - Point-in-Time Joins and Feature RetrievalFeast · support
Read Point-in-time joins (entity dataframes,
get_historical_features, TTL backward scan,filter_by_created_timestamp) and Feature retrieval (event_timestampas the inclusive upper bound,get_online_featureswithout timestamps, feature services per model version, materialize refresh). Work the join logic on tiny local tables; do not deploy Feast. Page read 2026-10-15 (v0.66-branch documentation). - MLflow Model Registry DocsMLflow · support
Read the Model Registry page (registered models, versions, lineage to the producing run, aliases such as @champion, and tags) and the registry tutorial promotion flow. Stages are deprecated since MLflow 2.9; use aliases and tags. Page read 2026-10-15; the versioned docs move, so re-pin the version you read.
- DVC Docs - Data VersioningDVC · support
Read
dvc add(Description and Example: Single file) for.dvccontent-hash sidecars, thedvc.yamlpage with itsdvc.lock filesection for pipeline state, andpushandpullfor transfer. A local directory remote is enough; do not set up cloud storage. Page read 2026-10-15. - PostgreSQL 18 Documentation - Recovery Targets, Backup Verification and RewindPostgreSQL Global Development Group · reference
Read Section 19.5.6 Recovery Target, the
pg_verifybackupreference and thepg_rewindreference for recovery stopping points, manifest checks and rejoining a diverged primary.