Lab · Reliability
Circuit breaker
Service A calls Service B. When B keeps failing, a circuit breaker in A stops calling it for a while and returns a fallback instead — protecting both services. Break B and watch the breaker move through its three states.
Try it
- Users — 6 req/s — healthy
- Service A — breaker closed — healthy — CLOSED — 3 waiting on calls
- Service B (dependency) — healthy — healthy — working on 3
- Fallback — cached or default answer — healthy
- Request
- Response
- Error / rejected
- Fallback
Breaker
Closed
Healthy: calls pass through
Calls reaching B
6/s
B is working on
3
Failed
1
1 errors · 0 timeouts
Fallbacks
0
answered without calling B
(The time within which 95 out of 100 requests finish.) wait
830 ms
Numbers add up:19 calls = 15 succeeded + 1 failed + 0 fallbacks + 3 in flightThe lab checks this sum as it runs, so a counting mistake would show here.
Controls
Breaker state
- 0.0s Closed — start
Show data table
| Time | Calls to B/s |
|---|---|
| 1s | 8 |
| 1s | 4 |
| 2s | 8 |
| 2s | 4 |
| 3s | 8 |
| 3s | 6 |
What just happened
Nothing yet. Start traffic or run an experiment.
Incident drill: Service B turns slow while the breaker is off
Service A calls Service B 10 times a second, and the circuit breaker is switched off. Something will go wrong soon. Watch "Failed" and "B is working on". The drill takes about 2 minutes at the default speed; the speed control above the diagram makes it faster.
What this model simplifies
- The failure window counts the last 10 calls and needs at least 5 before it can trip. Libraries such as Resilience4j also offer time-based windows and slow-call thresholds.
- One breaker for one dependency. Real services keep a separate breaker per downstream dependency (and sometimes per endpoint).
- The fallback always succeeds. In practice a fallback can be stale, partial, or unavailable too — design what users see when it is.