Season 2 closes with the three patterns that decide whether one slow dependency takes your whole system down with it. Parts 1–9 gave you the machinery for agreeing (leader election, consensus), coordinating (transactions, sagas), and finding each other (gossip, service discovery, locking). This part is about what happens when the machinery is slow — and the season's benchmark hook is the ugliest one yet: five layers that each retry three times turn one user request into 243 downstream calls. The patterns are individually trivial. Composed wrong, they are the outage.
The numbers below come from the companion notebook's seeded simulation (seed 42, 20,000 requests): a dependency with 50 ms median latency, 5% transient 503s, and a slow phase where 20% of requests take 3 seconds. The headline result: naive retries buy 4 points of success and cost 1.44x load; a 10% retry budget keeps three-quarters of that gain at 1.10x load; and a circuit breaker cuts wasted calls in a 60-second outage from 6,000 to 618.
The ELI5 version
A timeout is a promise you make to yourself: I will wait this long, and not a second longer. Without one, a slow dependency holds your thread, your connection, and your memory until it feels like answering — and while it holds them, your other requests queue behind it. That is a cascading failure: the dependency did not crash, it just got slow, and slowness spread like a cold through every service that called it.
A retry is a second chance: the request failed, maybe it was a blip, try again. The trap is that retries multiply. If your service retries 3 times, and the service you called retries 3 times, and the service it called retries 3 times, one user request becomes 27 calls to the database at the bottom — and if the database is the thing that is struggling, you just tripled its load at the worst possible moment.
A circuit breaker is the fuse box. When failures pass a threshold, it opens and every call fails fast, immediately, without touching the dependency at all. The dependency gets quiet time to recover; your callers get an instant error instead of a timeout; and after a cooling-off period the breaker lets a few probe calls through to check whether the dependency is healthy again. It is the only one of the three patterns that reduces load during an outage instead of adding to it.
Timeouts: size from the tail, not the median
Every network call needs three timeouts, not one: a connect timeout (how long to establish the connection — short, under a second on a LAN), a per-attempt request timeout (how long one call may take), and an overall deadline (the total budget for the whole operation, retries included). The per-attempt timeout is the one people get wrong, because they size it from the average. The average is 50 ms here. The p99 is 203 ms and the p99.9 is 314 ms — and the timeout has to sit above the tail, or it starts killing healthy requests.
The AWS Builders' Library rule, and the one this post uses: pick an acceptable false-timeout rate — say 0.1% — and set the timeout at the matching latency percentile, here p99.9. A 200 ms timeout looks generous against a 50 ms median and still kills 1.07% of healthy requests; at 100 requests a second, that is a false failure every second, all day. The timeout is not a guess about how fast the dependency should be; it is a statement about how much of its real latency distribution you are willing to amputate.
And the deadline matters more than the timeout. A 2-second deadline with 400 ms attempts and 50 ms of backoff fits four attempts (4×400 + 3×50 = 1,750 ms). If the remaining deadline cannot fit another attempt, do not start one — a call that begins with 100 ms left and a 400 ms timeout is work on a request whose caller has already given up. Propagate the remaining deadline downstream (gRPC does this natively with its deadline header) so no service does work for a caller that has left.
Retries: the multiplier nobody budgets
The simulation replays the same bad afternoon four ways. With a 1-second timeout and no retry, 76.1% of requests succeed — the honest number, because the 20% slow phase cannot answer inside a second and the 5% transient failures are unrecovered. Add three naive immediate retries and success rises to 80.0% — but mean downstream load rises to 1.44x per request, and during a real outage that 1.44x lands on a dependency that is already drowning. Cap retries at 10% of traffic and success is 76.9% at 1.10x load: three-quarters of the gain for a quarter of the cost.
The arithmetic behind the 243x is the season's sharpest hook. Three layers deep, three attempts each: 3×3×3 = 27 calls to the bottom layer per user request. Five layers: 243. The AWS Builders' Library states the five-layer version explicitly, and it is the reason the composition rule is absolute: retry at exactly one layer. Pick the application or the mesh, never both — a sidecar that retries under an application that retries is two layers of the same mistake. And retry only what is retryable: transient 5xx and timeouts on idempotent operations, never a 4xx, never a non-idempotent write without an idempotency key. A retried payment without a key is a double charge with a retry budget.
Retries also need backoff with jitter. Three immediate retries are the worst row in the experiment: every failed attempt is instantly replaced, the connection pool saturates again, and success falls below the no-retry baseline. Exponential backoff spreads the retries out; full jitter — randomizing each delay across the full backoff window — stops a thousand clients that failed together from retrying together, which is the thundering herd that turns a blip into a second outage.
Circuit breakers: the only pattern that sheds load
During a 60-second outage at 100 requests a second, with a 1-second timeout and no breaker, the system makes 6,000 wasted calls and holds 6,000 thread-seconds of work that was never going to succeed. With a breaker — trip at 50% failures over the last 100 calls, open for 10 seconds, three probe calls in half-open — the same outage costs about 618 calls. That is 9.7x fewer wasted calls, and the thread-seconds fall by the same factor, which is what actually keeps the rest of the system alive: the breaker protects the caller, not the dependency.
The three states are a small state machine with one hard tuning problem. Closed: calls flow, failures counted over a sliding window (Resilience4j's default: the last 100 calls, minimum 10 before evaluating, trip at 50%). Open: every call fails fast for the cooling-off period — 10 seconds is a common starting point, and it should be long enough for the dependency to actually recover, not just long enough to feel decisive. Half-open: a few probe calls are allowed through; if they succeed, the breaker closes, and if they fail, it opens again. The tuning trap is a window that is too wide to trip — a breaker that needs 100 failures to notice an outage that lasts 60 seconds at 100 requests a second will notice it after it is over.
Composition: one pipeline, one deadline, one owner per job
The three patterns plus the bulkhead from Part 5 compose in a fixed order, outermost to innermost on the caller side: bulkhead caps concurrent calls to the dependency including retries; the breaker sees the final outcome after retries and stops calling a dependency that is clearly down; retry with backoff and jitter absorbs brief transients, bounded by a retry budget; the per-attempt timeout bounds each individual call, set from the dependency's p99. On the callee side, a rate limit per tenant at the edge, then admission control that sheds excess work with a fast 503 and a Retry-After. And running through both: the single deadline that propagates downstream.
The availability arithmetic is why composition matters at all. Three services at 99.9% in a chain do not give 99.9% — they give 99.9%³ = 99.700%, or 1,575 minutes of downtime a year, against 525.6 minutes for a single 99.9% service. Three at 99.0% give 97.03%, or 15,611 minutes — nearly eleven days. Every hop multiplies the failure, not the uptime, which is why the resilience patterns are not optional garnish on a distributed system: they are the difference between a chain that holds and a chain whose weakest link sets the availability of everything above it.
Why it breaks: the failure modes, ranked
- The retry storm. The most common production outage of the three patterns: a dependency slows, every caller retries, load multiplies, the dependency slows further. Positive feedback, exactly as the Google SRE book defines cascading failure. The fix is a budget, not a hope.
- Timeout inversion. An inner timeout longer than the outer deadline means a service works on a request whose caller has already timed out and left. The work is wasted, the thread is held, and the caller never sees the answer.
- Two layers retrying. Application retries under mesh retries, or client retries over server retries: 3×3 = 9 calls where the design assumed 3, and nobody's dashboard shows it because each layer reports its own attempts as normal.
- The breaker that never trips. A sliding window wider than the outage, a failure-rate threshold set from the good days, a minimum-calls floor the traffic never reaches. The breaker is configured, tested in staging, and useless in production.
- Retries without idempotency. A retried non-idempotent write is a duplicate charge, a duplicate order, a duplicate side effect — and the retry that caused it looked like a success on every dashboard.
Takeaways
- Timeouts come from the tail. Median 50 ms, p99.9 314 ms: a 200 ms timeout falsely kills 1.07% of healthy requests. Pick a false-timeout rate and set the timeout at that percentile.
- Retries buy 4 points and cost 1.44x load. In the simulation, naive retries took success from 76.1% to 80.0%; a 10% retry budget kept 76.9% at 1.10x. Retries fix transients, never slowness.
- Amplification is multiplicative across layers. Three layers × three attempts = 27 calls; five layers = 243. Retry at exactly one layer, with backoff, jitter, and a budget — and only idempotent operations.
- The breaker is the only pattern that sheds load. 6,000 wasted calls in a 60-second outage became ~618 — 9.7x fewer, and 6,000 thread-seconds held became 618.
- Compose in a fixed order, under one deadline. Bulkhead, breaker, retry, timeout — outermost to innermost — with the deadline propagated downstream. Three 99.9% services in series give 99.7%, not 99.9%.
Follow for Season 3 — "System Design, Plainly — Season 3: Data in Motion & at Rest" starts tomorrow with message queues: at-least-once vs exactly-once — on dev.to/danielsamfdo.
Honesty note: all simulation numbers are this notebook's toy-model measurements, not production telemetry — lognormal latency (median 50 ms), 5% transient failures, a 20% slow phase at 3 s, seed 42, N=20,000. Field figures cited: AWS Builders' Library timeout-at-p99.9 rule and the 243x five-layer retry figure, Resilience4j defaults (100-call window, 10-call minimum, 50% threshold, 10 s open), the Google SRE book's cascading-failure definition, and the composition order from the resilience-patterns literature. No Meta content per the standing exclusion.
Companion notebook: timeouts_retries_breakers.ipynb — latency percentiles and false-timeout rates, four-way retry comparison, amplification arithmetic, breaker outage math, deadline budget and series availability, all exec-tested.
Companion notebook: the runnable tutorial for this post — download it here (open in Colab/Jupyter).




