InterviewSolution
| 1. |
What are Open, Closed and Half-Open states of Circuit Breaker? |
|
Answer» Circuit Breaker wraps the original remote calls inside it and if any of these calls fails, the failure is counted. When the service dependency is healthy and no issues are detected, the circuit breaker is in Closed state. All invocations are passed through to the remote service. If the failure count exceeds a specified threshold within a specified time period, the circuit trips into the Open State. In the Open State, calls always FAIL immediately without even invoking the actual remote call. The following factors are considered for tripping the circuit to Open State -
After a predetermined period of time (by default 5 SECONDS), the circuit transitions into a half-open state. In this state, calls are again attempted to the remote dependency. Thereafter the successful calls transition the circuit breaker back into the closed state, while the failed calls return the circuit breaker into the open state. |
|