Resilience Patterns
Retries alone make a struggling downstream worse, not better — every retry is another request piled onto a service that is already falling over. Circuit breakers stop calling a dependency that's failing, bulkheads stop one slow dependency from starving every other request, and backpressure makes overload visible instead of silently queuing forever. This note builds all three from the timeouts-and-retries baseline, shows how they compose, and covers the ways they fail too.
Prerequisites: Timeouts, retries, and thread/connection pool basics.
Cover these firstFailures, Timeouts & Retries
After this: Combine circuit breakers, bulkheads, and backpressure to contain a failing dependency instead of amplifying it.
Suggested first pass: Read sections 1–5, answer each section in your own words, then use the remaining failure modes and exercises as the advanced pass.
1. A timeout bounds how long you wait; a retry tries again after a transient failure — but naive retries during a real outage just multiply load on an already-struggling dependency.
2. A circuit breaker stops calling a dependency once it's clearly failing, giving it room to recover instead of piling on. A bulkhead isolates the resources (threads, connections) used for one dependency so its failure can't starve every other request.
3. Backpressure makes overload visible and bounded — reject or shed load explicitly, with a signal the caller can act on, instead of an unbounded queue that turns overload into an unrecoverable latency spiral.
Timeouts and retries (covered in Failures, Timeouts & Retries) answer "what do I do about one slow or failed call." Resilience patterns answer the harder question: what happens when a dependency is failing systemically, for seconds or minutes, under load from hundreds of callers simultaneously. At that point, more retries is more load on the thing that's already down — the fix has to change behavior at the caller-population level, not the single-call level. That's what circuit breakers, bulkheads, and backpressure are for.