Lab 07 of 09Circuit-breaker & retry-storm simulator
Trip the Breaker
Make a downstream API fail and watch naive retries turn it into a storm — then let a circuit breaker go Closed → Open → Half-open and save it.
Autoplay · touch any control to take over
- Served OK
- 100%
- Fallback
- 0%
- Errors
- 0%
- User p95
- —
- Load on API
- ×1.0
- Trips
- 0
Simulation · 25 user req/s · payments-api handles 12 calls at once and slows down past that · 1s client timeout · breaker: count-based window of 20, opens at 50%, 2s cooldown, 3 half-open probes · slowed 2.5× so you can see it
Built by Melih Kızmaz · runs entirely in your browser
What you are looking at
Users call checkout-svc, which calls payments-api. The API can handle about twelve calls at once; past that it slows down, and the slower it gets the more calls pile up. Every call has a one-second client timeout — and when the client gives up, the API does not know: it keeps working on the abandoned call (the hollow dots), burning capacity nobody will ever use.
Why retries can make an outage worse
Retrying immediately feels like resilience, but when the API is failing because it is overloaded, every retry is more load. With three immediate retries the API can see two to three times your real traffic exactly when it can least afford it — the “Load on API” number. Exponential backoff with full jitter spreads retries out so they stop arriving in synchronised waves, but it cannot turn a dead dependency into a live one.
What the breaker actually does
The breaker counts the outcomes of the last twenty calls. When at least half of them failed or timed out, itopens: calls are answered immediately with a fallback (a cached or degraded response) instead of waiting a second to fail, and the API gets room to recover. After a cooldown it goes half-open and lets three probe calls through; if they succeed it closes, if one fails it opens again. This is the same shape as resilience4j, Polly or opossum — a failing dependency should cost you milliseconds, not threads.
The numbers are a model, not a benchmark, and the whole thing runs 2.5× slower than real time so the dots are visible. The trade-off is real though: a breaker that opens too eagerly serves fallbacks to users who would have been fine, which is why the threshold, the window size and a meaningful fallback matter as much as the pattern.