Back to Catalog
Microservices
Resilience
Circuit Breaker
Stop hammering a failing service — trip the breaker, fail fast, recover gracefully.
Intent & Description
Real-world Use Case
Payment Service is down. Circuit Breaker on Order Service trips after 5 failures. Orders now fail fast with “payment unavailable” instead of hanging for 30s, keeping Order Service healthy for other operations.
Source
📌 TL;DR
Circuit Breaker = electrical fuse for your service calls. Trips when things go bad, self-heals when things recover. Essential for any distributed system.
Advantages
- Prevents cascade failures — isolates blast radius
- Fail-fast saves threads/resources on the caller side
- Automatic recovery testing via half-open state
- Improves overall system resilience with minimal code change
Disadvantages
- Threshold tuning is tricky — too sensitive = false trips, too loose = too slow to protect
- Half-open state needs careful handling to avoid thundering herd
- Adds complexity to call paths
- Needs coordination with fallback logic (what do you return when open?)