Hi Devs,

*Scenario*

The deployed services in a MSF4J may fail to serve the requests due to
various factors. e.g,
1. Less resources in the server.
2. High Load in the server
3, Some services take more time to respond etc.

In this kind of a situation, if the server is getting requests though there
is no resources to serve those requests, and eventually the server will get
unusable.

*Solution*

The Circuit Breaker design pattern can save the server from above
scenarios, The typical design can be illustrated as in the following
diagram.


So as in the above diagram, when number of failures of a particular
resource exceeds the Max Failure Count, then the state of that resource is
moved to the open state with a timeout value (Trip Breaker). At this point
the requests coming to the server is routed back without passing the
internal to process further.

After the timeout has reached, the state is moved to Half-Open state, and
if the consecutive request pass to the server to process (Attempt Reset),
if success then close the circuit (Reset Breaker), If fail then again move
the state to the Open with a timeout value (Trip Breaker).

Any thoughts, suggestions regarding the above approach?

References
[1].
http://www.javaworld.com/article/2824163/application-performance/stability-patterns-applied-in-a-restful-architecture.html?page=2
[2].
http://ssagara.blogspot.com/2015/05/timeout-and-circuit-breaker-pattern-in.html
[3]. https://pragprog.com/book/mnee/release-it


Regards,
Aruna
-- 

*Aruna Sujith Karunarathna *
WSO2, Inc | lean. enterprise. middleware.
#20, Palm Grove, Colombo 03, Sri Lanka
Mobile: +94 71 9040362 | Work: +94 112145345
Email: ar...@wso2.com | Web: www.wso2.com
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to