Resilience4j goes from CLOSED to HALF_OPEN directly without going to OPEN

134 views Asked by At

In a circuit breaker setup using resilience4j, the Circuit Breaker goes from CLOSED to HALF_OPEN directly without going to OPEN. Not just this, this happens when we are not providing the success of failure metrics to it. Two things are not clear here:

  1. How can the Circuit Breaker change its state when no metrics is provided to the same about the success or failure?
  2. What is the behavior of the circuit breaker going from CLOSED to HALF_OPEN, as theoretically it must go from CLOSED to OPEN and then to HALF_OPEN after the waiting period ?
1

There are 1 answers

0
butterCup On
  1. If no metrics are provided, CB uses the timeout mechanism to change its state. The circuit breaker uses fixed timeout value for each request on its own. If the external service call takes more time than the timeout value (example 100ms for each request) for responding, then it moves to OPEN after tripping.

  2. One possibility is if Retry is used in circuit breaker implementation. CB transition from CLOSED to HALF OPEN directly instead of OPEN due to retry logic to handle failure calls.