The Runtime Theory

Circuit Breaker States: Closed, Open, Half-Open

Watch the circuit breaker trip: failures counted in the closed state, the open short-circuit, the half-open trial probe, and how recovery is decided.

The Runtime Theory Team09 stages

trace / request.md

CLOSED: ALLCALLS PASSCALLS REACHTHE DEPENDENCYFAILURESACCUMULATEBREAKERTRIPS OPENOPEN: FAIL FASTCOOLDOWN RUNSHALF-OPEN:TRIAL CALLSPROBE DECIDESTHE STATECYCLE REPEATS

readyThe circuit is closed and every call passes through to the dependency. The breaker tracks failures in a sliding window, counting recent errors without blocking anything.

A circuit breaker is a state machine wrapped around a dependency call. This diagram shows the three states and the transitions between them: closed, where calls flow and failures are counted in a sliding window; open, where calls fail fast without reaching the dependency; and half-open, where a small probe decides whether to recover. The state machine exists because failing fast is a load-shedding decision: when a service is unhealthy, every caller retrying it just makes the problem worse.

The ordering of the transitions is the design. The failure window must accumulate before the trip, so transient blips don't break normal traffic. The cooldown must run before the probe, so recovery has time to happen. And the half-open probe is the only source of new information — the breaker stays open until the probe succeeds. Every trip and every recovery in a distributed system is this diagram running again.