Design Patterns (GoF) (50 Qs)•Part 2: Behavioral Patterns & Communication (11 - 24)
What is the Circuit Breaker Pattern in distributed systems?
senior LevelSystem DesignBehavioral
In Simple Words: Prevents cascading failures when a downstream microservice is down:
- Closed State: Normal operation; requests pass through.
- Open State: When failure rate exceeds a threshold (e.g. 50% timeouts), the circuit opens immediately. All requests fail fast without calling the remote service, preventing thread exhaustion.
- Half-Open State: After a timeout, sends a single test probe request. If it succeeds -> reset to Closed; if it fails -> remain Open.