NOTE
Designing a Circuit-Breaker System
A historical note on circuit breaking, the circuit-breaker pattern, and its difference from rate limiting.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is Circuit Breaking?
- A caller invokes a callee. When the number of errors reaches a threshold, the caller stops invoking the callee; when the callee recovers, calls resume.
- A Fail-Fast strategy in fault tolerance.
2. How to Implement Circuit Breaking
2.1. Circuit-Breaker Pattern

- Use a proxy, the circuit-breaker object, to take over a service caller’s remote requests one-to-one: one remote service corresponds to one circuit-breaker object.
- Service A calls service B. A counts errors. When (errors + timeouts) / total requests reaches a threshold, the circuit breaker trips and A stops calling B.
- Every once in a while, let a few requests through to probe B. If B has recovered, resume calls.
3. Circuit-Breaker Component
Designing a Fault-Tolerance Component.md
4. Circuit Breaking vs Rate Limiting
- Service A calls service B.
- Circuit breaking protects A itself, while rate limiting protects service B.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub