Reading — step 1 of 5
Read
~1 min readHealth Checks
Circuit Breakers
A circuit breaker is a per-backend state machine that prevents cascade failures when a backend is misbehaving:
CLOSED ----failure_rate exceeds threshold----> OPEN
^ |
| (timeout)
| v
+---success_rate exceeds threshold------ HALF_OPEN
States:
- CLOSED: normal operation; requests flow through; track failures
- OPEN: short-circuit immediately; return error without contacting backend
- HALF_OPEN: allow a small number of "probe" requests; based on success rate, transition to CLOSED or back to OPEN
Why this matters: when a backend is overloaded, sending more requests makes it worse (queues fill, threads exhaust). The circuit breaker says "stop trying for 30 seconds, give it room to recover".
Implementation:
python
This pattern came from Netflix's Hystrix. Now standard in service meshes (Istio, Linkerd) and most language frameworks (resilience4j, Polly).
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…