NEW
A resilience pattern that stops calls to a failing dependency, allowing it to recover and preventing cascading failures.
DESCRIPTION
The circuit breaker monitors requests to an external dependency and opens when failures cross a threshold. While open, calls fail fast or use fallbacks, protecting resources and improving overall stability. After a cool-down, a half-open state probes recovery before closing again. It pairs with timeouts, retries with backoff, and bulkheads for robust microservice resilience. Libraries like Resilience4j and platform meshes implement it consistently.
ALTERNATIVE DEFINITIONS
Microsoft Learn
This pattern prevents an application from repeatedly trying to execute an operation that is likely to fail.
Highlights prevention of repeated failing operations.
Martin Fowler
You wrap a protected function call in a circuit breaker object, which monitors for failures.
Describes the core wrapping and monitoring mechanism.
RELATED TERMS
Bulkhead Pattern Timeout Rate Limiting Backoff Fail Fast Fallback Service Mesh Health Check Load Shedding
COMPETING TERMS
RELATIONS
- Broader: Circuit Breaker Pattern
KNOWLEDGE AREAS
Software Engineering Infrastructure Platform & Tooling
TARGET AUDIENCE
Software Developer Software Architect DevOps Engineer Solution Architect Cloud Architect IT Manager
EXTERNAL SOURCES
- Wikipedia - Circuit breaker design pattern
- Resilience4j - Java circuit breaker library
- Istio - Service mesh circuit breaking
- AWS Architecture Blog - Fail fast and recover guidance
TOP QUESTIONS
When should I use a Circuit Breaker?
Use it when a downstream dependency becomes unreliable, to fail fast and prevent resource exhaustion and cascading failures.
Category: Requirements
How is a Circuit Breaker different from Retries?
Retries attempt recovery; circuit breakers stop repeated attempts during failures. Combined, they balance resilience and load.
Category: Comparison
What are common mistakes with Circuit Breakers?
Thresholds too sensitive or too lax, ignoring timeouts, and lacking fallbacks cause either false trips or prolonged failures.
Category: Mistakes
How do I test a Circuit Breaker?
Inject faults, simulate latency, and verify state transitions (closed, open, half-open) with observability on success and failure rates.
Category: Testing
What metrics govern Circuit Breaker behavior?
Failure rate, consecutive failures, slow-call rate, and recovery success in half-open state.
Category: Measurement
Where to implement Circuit Breakers?
In client libraries, API gateways, or service meshes for consistent, centralized policies.
Category: BestPractices
What’s a good fallback strategy with Circuit Breakers?
Serve cached or degraded responses and clearly surface partial availability to users.
Category: Example
Do Circuit Breakers harm availability?
When tuned correctly, they improve overall availability by isolating failures and enabling rapid recovery.
Category: Opinion
What is a hot topic around Circuit Breakers?
Service-mesh enforced policies and adaptive breakers tuned by real-time SLOs are gaining traction.
Category: Topic