152 Retry and Circuit Breaker Patterns

152 Retry and Circuit Breaker Patterns

Retries and circuit breakers are control systems. Misconfigured control loops create amplification and cascades.

Decision Flow

call fails -> classify error -> retryable?
             |                  |
             no                 yes -> backoff -> retry limit -> fail fast

Retry Boundaries

Only retry operations that are safe (idempotent or explicitly deduplicated). Keep attempt count small and bound total elapsed time.

Circuit States

closed -> open -> half-open -> closed
  • Closed: normal traffic.
  • Open: reject quickly to reduce pressure.
  • Half-open: probe limited requests to test recovery.

Practical Outcome

Well-tuned policies improve availability during partial outages; poorly tuned policies turn partial outages into system-wide incidents.