Circuit breaker
Description
A circuit-breaker is a state machine inserted between caller and downstream that monitors failures and trips OPEN when failures exceed a threshold, refusing further calls until a probe (HALF-OPEN) confirms recovery. The diagnostic shape: a downstream dependency starts failing or slowing; without a breaker, every caller waits the full timeout and the failure cascades upstream as latency or queue-saturation; with a breaker, calls fail-fast once the threshold trips, freeing caller resources and letting the system shed load gracefully. The structural lineage is the electrical circuit breaker — the literal namesake. Over-current in an electrical circuit trips the breaker; the breaker is binary (closed-conducting or open-not-conducting); reset is manual or automatic. The software pattern adds HALF-OPEN as an intermediate probe state — a single test call after a cooldown — so the breaker can self-heal without operator intervention. Circuit-breaker is the binary-gate sibling of backpressure (which is continuous-gradient throttle). Both regulate flow under stress; they’re complementary, not interchangeable. Backpressure handles the steady-state “downstream is slow,” circuit-breaker handles the failure-mode “downstream is broken.”Triggers
User-initiated: User describes cascading failure, downstream timeouts causing upstream queues to fill, or wants to add fail-fast behavior. Vocabulary cues: “circuit breaker,” “fail fast,” “trip,” “cascading failure,” “downstream timeout,” “fallback.” Agent-initiated: Engine notices a system with synchronous calls to a downstream that has no fail-fast story — every caller waits full timeout on failure. Candidate inference: “this needs a circuit breaker — what’s the failure threshold, the cooldown, and the HALF-OPEN probe?” Situation-shape signals: Synchronous dependency on a downstream that can fail; observed cascading failure pattern (downstream slowdown → upstream queue saturation → upstream failure); need to shed load gracefully rather than wait for timeouts.Exclusions
- Asynchronous fire-and-forget — no synchronous caller to protect; the breaker has nothing to gate.
- Single, must-succeed downstream — if there’s no fallback, the breaker just trades waiting-for-timeout for failing-fast; same outcome, different latency. Sometimes still worth it for resource liberation; sometimes not.
- Downstream failures are transient and short — if the typical failure window is shorter than the breaker’s window, the breaker just adds noise.
- Idempotency-sensitive operations — careful: a breaker may cause callers to retry against a different replica or region; if the operation isn’t idempotent, the breaker’s failover behavior is a footgun.
Structure
Relationships
- backpressure — complementary regulation: backpressure for steady-state throttle, circuit-breaker for failure-mode containment.
- graceful-degradation — breaker-OPEN is the trigger for fallback to degraded mode.
- bulkhead — breakers per-dependency are bulkheads; one downstream’s failure doesn’t trip breakers on other downstreams.
- feedback-loop — the breaker is a feedback loop on downstream health.
Examples
Electrical circuit breakers · engineering-and-technology
Electrical circuit breakers · engineering-and-technology
Trading-floor circuit breakers · economics
Trading-floor circuit breakers · economics
AWS SDK retry-with-circuit-breaker · computer-science
AWS SDK retry-with-circuit-breaker · computer-science
Biological fever-induced behavior · biology
Biological fever-induced behavior · biology
Electrical engineering: thermal-magnetic miniature circuit breakers (IEC 60898-1, household/residential overcurrent protection) — the literal namesake and structural ancestor. · engineering-and-technology
Electrical engineering: thermal-magnetic miniature circuit breakers (IEC 60898-1, household/residential overcurrent protection) — the literal namesake and structural ancestor. · engineering-and-technology
Fowler, M. (2014). "CircuitBreaker." martinfowler.com — the modern reference write-up of the software pattern (CLOSED / OPEN / HALF-OPEN), building on Michael Nygard's *Release It!*. · computer-science
Fowler, M. (2014). "CircuitBreaker." martinfowler.com — the modern reference write-up of the software pattern (CLOSED / OPEN / HALF-OPEN), building on Michael Nygard's *Release It!*. · computer-science
Hystrix documentation (Netflix, 2012) — the implementation that popularized the pattern. · computer-science
Hystrix documentation (Netflix, 2012) — the implementation that popularized the pattern. · computer-science
Hystrix (Netflix), Resilience4j, Istio circuit breakers — production implementations widely deployed at industrial scale · computer-science
Hystrix (Netflix), Resilience4j, Istio circuit breakers — production implementations widely deployed at industrial scale · computer-science
Mental-health "I'm done" · psychology
Mental-health "I'm done" · psychology
Netflix Hystrix / Resilience4j / Istio service mesh · computer-science
Netflix Hystrix / Resilience4j / Istio service mesh · computer-science
Nuclear reactor SCRAM rods · engineering-and-technology
Nuclear reactor SCRAM rods · engineering-and-technology
Nygard, Michael (2007) Release It! — Production-Ready Software, Chapter 5 (Stability Patterns); Hello Interview primer on circuit breakers · computer-science
Nygard, Michael (2007) Release It! — Production-Ready Software, Chapter 5 (Stability Patterns); Hello Interview primer on circuit breakers · computer-science
Security tripwires / IDS · computer-science
Security tripwires / IDS · computer-science