resilience
Circuit Breaker
Prevent cascading failures — CLOSED → OPEN → HALF_OPEN state machine
StateCLOSED
Consecutive Failures0 / 3
Failure Counter
·
·
·
0/3 to trip// event log
No events yet. Click "Simulate Success" or "Simulate Failure" to begin.
// how it works
- CLOSED: Requests flow normally. Track consecutive failures.
- If failures ≥ threshold → switch to OPEN
- OPEN: All requests fail fast immediately. Start a timer.
- After timeout → switch to HALF_OPEN
- HALF_OPEN: Allow ONE probe request through.
- Probe succeeds → CLOSED (reset). Probe fails → back to OPEN.
// trade-offs
- Prevents cascading failures across services
- Fast failure response — no waiting for timeouts
- Automatic recovery via HALF_OPEN probing
- Needs careful threshold tuning
- Can mask intermittent errors
- Single probe in HALF_OPEN may not be representative