circuit breaker
A wrapper around calls to another service that stops making calls for a while after repeated failures, so the failing service can recover.
In more detail
Closed is normal: calls go through and failures are counted. After too many failures it trips to Open and rejects calls instantly (failing fast) for a cool-off period. Then it moves to Half-Open and lets a few trial calls through; enough successes close it again, and any failure reopens it.
Related terms
- retry — Sending a request again after it failed or timed out, in the hope that it succeeds the second time.
- resilience — An application's ability to keep working, or fail gracefully, when a dependency is slow or failing.
- Polly — A .NET resilience library for retries, circuit breakers, timeouts and related strategies around unreliable calls.
- cascading failure — A failure in one part of a system that overloads or breaks the parts around it, spreading until much more is down.
- fail-fast — Stopping immediately with a clear error as soon as something is wrong, rather than limping on and failing later in a confusing way.
- graceful degradation — Continuing to work with reduced features when part of the system fails, instead of failing completely.
- retry storm — A flood of retries from many clients at once that hits an already struggling service harder than the original traffic.
- state machine — A model in which something is always in exactly one named state, such as idle, loading, success or error, and only defined events move it to another.
- half open — The circuit breaker state that allows a few trial requests through to test whether the dependency has recovered.
- fail fast — Returning an error immediately rather than waiting on something that is likely to fail.
- flapping — Rapidly switching back and forth between two states, such as a breaker opening and closing repeatedly.
Taught in
- Retry and Circuit Breaker Policies with Polly — Modern .NET Core, C# & Enterprise Microservices
- Resilience Engineering: Circuit Breakers & Retries — Production Full-Stack Engineering
- Full-Stack System Verification: Capstone Integration — Production Full-Stack Engineering
- Circuit Breakers — Scalable System Design & Distributed Architecture