dev-tools

Circuit Breaker

A circuit breaker is a resilience pattern that stops your service from repeatedly calling a dependency that's already failing. Like the electrical device it's named after, it has three states: closed (calls flow through normally), open (after too many failures, calls are rejected instantly without even trying), and half-open (after a cooldown, it lets a trickle of requests through to test whether the dependency recovered). The point is to fail fast: instead of thousands of requests piling up on a dead database — exhausting threads and connection pools and dragging down your whole app — the breaker trips and you return a fast error or a cached fallback. This prevents one struggling dependency from cascading into a full outage. For SaaS builders integrating third-party APIs (payments, email, an LLM provider), a circuit breaker is essential defensive plumbing. It pairs with timeouts, retries with backoff, and bulkheads; service meshes and libraries like resilience4j often provide it out of the box.

Related terms

More Dev Tools terms