Circuit breaker is a design pattern which is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring. The circuit breaker design pattern works much like an electrical circuit breaker which is intended to “trip” or open the circuit when failure is detected. In a software application, a circuit breaker functions as a proxy that executes the remote services and monitors the remote service for failures. A failure can be an exception and/or a timeout. When the number of failures exceeds a predetermined threshold within a specified time period, the circuit breaker shuts off access to a service.
It is useful to develop a contingency plan, which describes what will be happening when the faulty service will be unreachable. You may either increase the retry period, re-route users to some other service or reduce functionality for the period of unavailability. This can prevent an application from repeatedly trying to execute an operation that's likely to fail, allowing it to continue without waiting for the fault to be fixed. The circuit breaker pattern also enables an application to detect whether the fault has been resolved. If the problem appears to have been fixed, the application can try to invoke the operation again.
Roxy-WI provides a great possibility to start Circuit Breaking in a couple of clicks.
Go to the Haproxy-Add proxy section. Choose what you would like to create: Listner or Backend. Press the Show Advanced settings button.
Tick the Circuit Breaking checkbox and choose parameters according to this description.
|observe layer7||Monitor live traffic for HTTP errors.|
|observe layer4||Monitor live traffic for TCP errors.|
|error-limit 50||Number of errors considered as the threshold|
|on-error||The action to be performed when the threshold is exceeded|
|mark-down||Mark the service as down|
|fail-check||Simulate a failed check, also forces fastinter (default)|
|sudden-death||Simulate a pre-fatal failed health check, one more failed check will mark a server down, forces fastinter|