Skip to content

Circuit Breaker Pattern

When a downstream dependency fails repeatedly, stop attempting calls temporarily to prevent cascade failures, allow the dependency to recover, and fail fast to preserve system resources for requests that can succeed.

Tension Addressed

Simplicity vs. Resilience (adds complexity but prevents cascade failures)

Recognizable As

Three states (closed/open/half-open); failure thresholds; timeout periods; fallback behaviors; "service unavailable" responses that appear immediately rather than after timeout

Canonical Sources

Nygard, "Release It!" (2007, 2018); Fowler, "CircuitBreaker" pattern (2014)

Transfers To

Electrical Engineering (original concept), API Clients (client-side protection), Service Meshes (infrastructure-level protection), Mobile Apps (offline mode transitions)

The circuit breaker prevents the "thundering herd" problem where a failing service gets overwhelmed by retries. Named after electrical circuit breakers that protect against overcurrent, the pattern recognizes that sometimes the fastest failure is the best response.

Sub-concepts: - State Machine: Closed (normal), Open (failing fast), Half-Open (testing recovery) - Failure Detection: Count-based vs. rate-based thresholds