A circuit breaker with Failurewall's interface implemented by Akka's CircuitBreaker.
Whether a circuit breaker should increment the error counter or not.
A circuit breaker should not increment its own error counter.
A circuit breaker should not increment its own error counter.
- the call is successful - the operation is failed due to a business logic error such as a validation error or a 404 error
A circuit breaker should increment its own error counter.
A circuit breaker should increment its own error counter.
- the remote service or resource crashes - timeout happens
A circuit breaker with Failurewall's interface implemented by Akka's CircuitBreaker. Calls wrapped in AkkaCircuitBreakerFailurewall are protected by circuit breaker mechanisms. A circuit breaker prevents a failure form cascading any other failures.
A circuit breaker is a state machine that has a following state.
- CLOSED - OPEN - HALF-OPEN
The
CLOSED
state is the ordinary state. In this state, calls are executed and failure statistics are recorded. When failure count exceeds the threshold, the circuit breaker switches into theOPEN
state.The
OPEN
state is the state under problems. In this state,call
never executes thebody
and returns an error immediately, so-calledfail-fast
. TheOPEN
state prevents applications from accessing resources under problems. After the configured timeout, the circuit breaker switches into theHALF-OPEN
state.The
HALF-OPEN
state is the challenge phase. In this state, the firstcall
executes thebody
in order to test that the problem is fixed. The other calls never execute bodies and return errors immediately. If the first call succeeds, the circuit breaker switches toCLOSED
state. If the first call fails, the circuit breaker switches toOPEN
state.