← All Quizzes
What is the circuit breaker pattern and when is it used?
Explanation
The circuit breaker pattern prevents an application from repeatedly calling a failing service, which could cause cascading failures. It has three states: closed (normal operation), open (calls fail fast without hitting the service), and half-open (limited calls to test recovery). After a threshold of failures, the circuit opens. After a timeout, it enters half-open to test if the service has recovered. This pattern is essential in microservices and distributed systems for resilience.