vishal patel
UnderstoodIntermediateUpdated 2026-09-23

Circuit Breaker, Retry, Timeout & Bulkhead

The resilience toolkit — fail fast, retry safely, bound waiting, and isolate resources so one slow dependency can't take down the whole system.

resiliencefault-toleranceavailability

The problem

A downstream service gets slow rather than down. Callers wait, threads and connections pile up, and the caller runs out of resources too. The failure cascades upstream.

The four tools

diagram
ToolWhat it doesKey setting
TimeoutNever wait foreverSet from the dependency's p99, not a guess
RetryHandle transient failuresExponential backoff + jitter, capped attempts, only for idempotent ops
Circuit breakerStop calling a failing dependency; probe for recoveryFailure-rate threshold, cool-down window
BulkheadSeparate pools per dependency or tenant so one can't exhaust allPool/queue size per dependency

Plus fallbacks (cached or default response) and load shedding (reject early with 429/503 when saturated).

Gotchas

  • Retry storms: retries at every layer multiply load (3 layers × 3 retries = 27 calls). Retry at one layer only, and use retry budgets.
  • Retrying non-idempotent writes creates duplicates. See Idempotency.
  • A circuit breaker without metrics is a black box. Emit a state-change event every time it opens or closes.
Architect's tip

In multi-tenant platforms, bulkhead by tenant for heavy jobs (bulk publish, imports). One enterprise tenant's 200k-item job shouldn't starve everyone else's queue.

Cheatsheet

The whole topic on one page. Click to open full screen.

Sources & further learning

Videos, courses, docs and books I recommend for this topic.

Related topics