What is Circuit Breaker Pattern?
It is fail fast (and in a controlled way, with good error and logging message), when your application is under load. If your application does not handle load gracefully, your application will continue to accept incoming request and that makes performance of your application worse, but more important makes the response time even worse for the connecting clients.
"Handle faults that might take a variable amount of time to recover from, when connecting to a remote service or resource. This can improve the stability and resiliency of an application."
https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker
Java EE 7 Circuit Breaker Implementation
@Singleton
@Interceptors(Breakr.class)
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class Brittle {
@IgnoreCallsWhen(failures = 2,slowerThanMillis = 10)
public void unstableAndSlow(){
}
@CloseCircuit
public void reset() {}
}
http://www.adam-bien.com/roller/abien/entry/a_6kb_circuit_breaker_for
No comments:
Post a Comment