Spring / Resilience4j Interview questions
How is failure rate calculated in a CircuitBreaker?
The failure rate is the percentage of calls in the current sliding window that either threw a recorded exception or exceeded the slow-call duration threshold, measured once enough calls have accumulated to satisfy minimumNumberOfCalls.
Concretely: if the window holds 100 calls and 40 of them failed or ran slow, the failure rate is 40%; once that crosses failureRateThreshold, the breaker transitions from CLOSED to OPEN.
Slow calls and failed calls are tracked as two related but separate rates - failureRateThreshold for exceptions, slowCallRateThreshold for calls slower than slowCallDurationThreshold - and either one crossing its threshold on its own is enough to open the breaker.
More Related questions...