What is the Circuit Breaker pattern?
Answer
The Circuit Breaker pattern prevents a service from repeatedly calling a downstream service that is failing, which would waste resources and potentially cascade the failure. It works like an electrical circuit breaker: in the Closed state, requests pass through normally; if failures exceed a threshold, it trips to the Open state, where all requests immediately fail with a fallback (no network call is made); after a timeout, it enters the Half-Open state where a single test request is sent — if it succeeds, the breaker closes again, otherwise it opens again. Libraries like Resilience4j (Java) and Polly (.NET) provide circuit breaker implementations. Service meshes like Istio can also enforce circuit breaking transparently without library changes.
Previous
What is event sourcing in microservices?
Next
What is the Bulkhead pattern in microservices?
More Microservices Architecture Questions
View all →- Intermediate What is event-driven architecture and how does it apply to microservices?
- Intermediate What is the Saga pattern in microservices?
- Intermediate What is CQRS (Command Query Responsibility Segregation)?
- Intermediate What is event sourcing in microservices?
- Intermediate What is the Bulkhead pattern in microservices?