Why circuit breaker?
A flaky downstream service and a shared connection pool. Watch what happens when every caller waits out the timeout versus when a breaker fails fast.
The idea in 27 seconds
A fixed animation — no controls, nothing to configure. It shows the shape of the problem and the shape of the fix, with the story written out underneath.
~27s animated walkthrough: a hung downstream call exhausting a connection pool vs. a breaker failing fast.
Service A calls Service B, and for the first few seconds it's unremarkable: request out, response back, request out, response back. This is the shape of almost every dependency you own.
Then Service B gets slow. Not down — slow, which is worse, because a down service answers instantly and a slow one answers never. Service A's calls stop returning, so it does the thing everyone's HTTP client does by default: it retries. Watch the pending counter climb — 1, then 4, then 9, then 16 — each retry holding a connection open and waiting on a service that is not going to answer. Service A isn't broken; it's just completely full of requests that are going nowhere.
Now the bill comes due upstream. Service A's pool is exhausted, so it can no longer serve anyone — including the callers asking for things that have nothing to do with Service B. The client goes red. One slow dependency has taken down a service that was perfectly healthy, and from the client's point of view your whole system is down.
So a breaker goes in between them. While things are fine, it does nothing but count. Three consecutive failures and it flips open — and now the calls fail in microseconds instead of hanging for thirty seconds, so the pool never fills and Service A keeps serving everything else. After a cooldown it lets exactly one trial request through to check whether B has recovered. It has, so the breaker closes and normal traffic resumes.
The point. A circuit breaker doesn't make the failing call succeed — it makes failing cheap. The resource you're protecting isn't the downstream service, it's your own thread and connection pool, which is what actually decides whether one dependency's bad day becomes everybody's outage.
Interactive traffic simulator
Now drive it yourself. Set the downstream failure rate, pool size, trip threshold, and cooldown, then watch real counters — pool slots, fast-fails, pool rejections, breaker state transitions — respond to your settings.
- Failures are expensive precisely because they're slow. A failing call still holds a pool slot for the full timeout — often longer than a successful call.
- A full pool fails everyone, not just the doomed calls. Turn the breaker off and crank the failure rate — watch "pool rejected" climb even though some requests would have succeeded.
- Failing fast is a feature. With the breaker on, a fast-failed request costs ~0ms instead of the full timeout, and the half-open probe checks recovery without risking the whole pool.
Related guides & quizzes
The simulator builds the intuition. These go deeper on the tradeoffs, then check whether it stuck.