A circuit breaker is a resilience pattern that wraps calls to a remote dependency and stops sending requests once too many of them fail. Instead of waiting on timeouts, callers get an immediate error or a fallback answer while the dependency recovers.
Why it matters
A slow or dead dependency is more dangerous than a fast failure. Threads pile up waiting, queues fill, and one broken payment API can take down your whole checkout. A breaker turns that slow failure into a fast, contained one and gives the struggling service room to recover instead of hammering it with retries.
Example
A breaker has three states:
- Closed: requests flow normally and failures are counted.
- Open: after, say, 5 failures in 30 seconds, calls fail instantly for a cooldown period such as 60 seconds.
- Half-open: after the cooldown, a few trial requests are allowed. If they succeed the breaker closes; if they fail it opens again.
Your monitoring should alert when a breaker opens, because users are now seeing degraded behavior even though no server is technically down.
Common mistakes
- Setting the failure threshold so low that a handful of ordinary timeouts opens the breaker and causes an outage on its own.
- Opening the breaker with no fallback, so users just see errors faster.
- Not exposing breaker state as a metric, which hides the problem from dashboards until customers complain.
- Using one shared breaker for several unrelated endpoints, so one bad route blocks healthy ones.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.