From Surf Wiki (app.surf) — the open knowledge base
Circuit breaker design pattern
Software development pattern
Software development pattern
The Circuit Breaker is a design pattern commonly used in software development to improve system resilience and fault tolerance. Circuit breaker pattern can prevent cascading failures particularly in distributed systems. In distributed systems, the Circuit Breaker pattern can be used to monitor service health and can detect failures dynamically. Unlike timeout-based methods, which can lead to delayed error responses or the premature failure of healthy requests, the Circuit Breaker pattern can proactively identify unresponsive services and can prevent repeated attempts. This approach can enhance the user experience.
The circuit breaker pattern can be used in conjunction with other patterns, such as retry, fallback, and timeout, to enhance fault tolerance in systems.
Challenges
According to Marc Brooker, circuit breakers can misinterpret a partial failure as total system failure and inadvertently bring down the entire system. In particular, sharded systems and cell-based architectures are vulnerable to this issue. A workaround is that the server indicates to the client which specific part is overloaded and the client uses a corresponding mini circuit breaker. However, this workaround can be complex and expensive.
Different states of circuit breaker
- Closed
- Open
- Half-open
Closed state

When everything is normal, the circuit breakers remain closed, and all the requests pass through to the services. If the number of failures increases beyond the threshold, the circuit breaker trips and goes into an open state.
Open state

In this state circuit breaker returns an error immediately without even invoking the services. The Circuit breakers move into the half-open state after a timeout period elapses. Usually, it will have a monitoring system where the timeout will be specified.
Half-open state

In this state, the circuit breaker allows a limited number of requests from the service to pass through and invoke the operation. If the requests are successful, then the circuit breaker will go to the closed state. However, if the requests continue to fail, then it goes back to open state.
References
References
- (2023). "Machine Learning in Microservices Productionizing Microservices Architecture for Machine Learning Solutions". Packt Publishing.
- Richards, Mark. "Microservices AntiPatterns and Pitfalls". O'Reilly.
- (2022). "Kubernetes Native Microservices with Quarkus and MicroProfile". Manning.
- "Understanding Distributed Systems".
- "Will circuit breakers solve my problems?".
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about Circuit breaker design pattern — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report