Skip to content

What it is

A circuit breaker wraps calls to a dependency and trips open after repeated failures, failing fast instead of letting requests pile up against a service that is already struggling.

A circuit breaker is a state machine that sits between a caller and a dependency. It counts successes and failures. When failures exceed a threshold, it "opens": further calls return an error immediately, without ever reaching the dependency. After a cooldown period, it enters a "half-open" state and lets a few test calls through. If those succeed, it closes and resumes normal operation; if they fail, it opens again.

The point is not to fix the dependency. The point is to stop wasting the caller's resources (threads, connections, latency budget) on calls that are almost certain to fail.