‹ All demos
LiveSystem design · Resilience

Circuit breaker

Make a service your API depends on fail or hang. Watch threads pile up — and how a circuit breaker keeps the rest of the API alive.

How it works

  1. 1Every call to another service holds a thread until it answers. If that service hangs, threads run out and the whole API stops — even endpoints that never call it.
  2. 2A circuit breaker counts recent failures. Past a threshold it opens, and calls fail at once instead of waiting.
  3. 3After a pause it lets a few trial calls through. If they work, it closes again.

Read the post: How to build an API for 100,000 requests a second