/System Design /Circuit Breaker ← All Designs

Circuit Breaker

Stop cascading failures by automatically cutting off failing services

PHASE 3 SYSTEM DESIGN INTERACTIVE
State Machine
🟢
CLOSED
Normal
failure rate
> threshold
timeout
elapsed
🔴
OPEN
Blocking
timeout
elapsed
🟡
HALF-OPEN
Testing
HALF-OPEN: success → CLOSED  |  failure → OPEN
✓ CLOSED — Requests passing through
Request Flow
👤
CLIENT
CIRCUIT
BREAKER
⚙️
SERVICE
60%
Failure Rate
0%
failure rate
Threshold: 50%
window: 10 reqs
Request History (latest → right)
🟢 accepted🔴 failed⬛ fail-fast (open)
CLOSED
Current State
0%
Failure Rate
0
Requests Blocked
0
State Transitions
📖 State Explanation
Key Concepts
🎯 When to Use
Any synchronous call to an external service that can degrade — databases, microservices, third-party APIs. Prevents cascading failures.
⚖️ Trade-offs
False positives cause unnecessary outages; slow detection if window too large; need fallback behavior when open (cached data, degraded response).
💡 Interview Tip
"Netflix's Hystrix popularised circuit breakers. In OPEN state, return cached data or a degraded response — don't just error to the user."