Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-04-03 Thread Frank Leymann
The example about "just bad timing" that Sanjiva has, is a wonderful case of the "out-of-spec"-errors that Nygard has in mind. I think we can abstract this case into issues in systems based on optimistic concurrency control, i.e. systems in which you expect concurrency conflicts to occur only

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-04-02 Thread Afkham Azeez
On Sun, Apr 3, 2016 at 6:48 AM, Sanjiva Weerawarana wrote: > :-). I think there are two things we should show: > - one can do circuit breaker (CB) with MSF4J > - when should you use it > > Wrapping of DB calls in Hystrix may indeed be appropriate in some cases, > but not

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-04-02 Thread Sanjiva Weerawarana
:-). I think there are two things we should show: - one can do circuit breaker (CB) with MSF4J - when should you use it Wrapping of DB calls in Hystrix may indeed be appropriate in some cases, but not commonly. Second, at that level its really not about MSF4J at all. If we show a sample that's a

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-04-01 Thread Afkham Azeez
Well one of your responses indicated that the the blogpost suggests wrapping all DB calls in circuit breakers, and Frank's response indicated that it is suggesting wrapping all calls to external systems in circuit breakers. If it can confuse such brilliant minds, I guess it could mislead an

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-04-01 Thread Sanjiva Weerawarana
Azeez, asking questions and asking to understand what the purpose of some code is not a criticism. Of course there should be a sample! I only asked about it because to me a client side sample made more sense - and then it went into a discussion of when this should be used etc.. I would not only

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-31 Thread Afkham Azeez
The blog post has been removed. Sorry for all the confusion. This was only done as part of the agreement we had during last week's meeting to demonstrate certain features such as Spring support, JPA support, support for patterns etc. in order to help developers understand how to implement certain

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-31 Thread Afkham Azeez
On Thu, Mar 31, 2016 at 5:03 PM, Frank Leymann wrote: > Yes, all the stability patterns (that Nygard describes, the circuit > breaker being just one of them) > is not associated with microservices, but applies to all distributed > applications. In fact, Nygard's > book has been

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-31 Thread Frank Leymann
Yes, all the stability patterns (that Nygard describes, the circuit breaker being just one of them) is not associated with microservices, but applies to all distributed applications. In fact, Nygard's book has been published in 2007, lng before the microservice discussion came up ;-) Applying

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-31 Thread Sanjiva Weerawarana
Agreed. However I had understood that the circuit breaker pattern was advocated primarily for service clients in MSA (and of course it has nothing do with being micro). The general story of better failure handling applies to all code and is of course not MSA specific. Anyway .. Sample is fine.

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Afkham Azeez
On Thu, Mar 31, 2016 at 9:04 AM, Sanjiva Weerawarana wrote: > That's why I said "fancy try catch" :-). > > However, are you SERIOUSLY saying that we for example should be wrapping > all our DB access code in this stuff? If not who exactly should be doing > this? What are the

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Sanjiva Weerawarana
That's why I said "fancy try catch" :-). However, are you SERIOUSLY saying that we for example should be wrapping all our DB access code in this stuff? If not who exactly should be doing this? What are the perf implications? Of course wrapping remote service calls in this stuff makes sense -

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Afkham Azeez
Equating these fault tolerance patterns to Java 8 Optional or try-catch, is a highly oversimplified view. What Hystrix and these patterns provides is a framework for building fault tolerant systems. Something that is useful in the toolkit of an architect & developer. On Thu, Mar 31, 2016 at 8:36

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Afkham Azeez
The same concept applies to the client side as well. We could modify this sample to show interaction between two microservices, where one service calls the other, and if that call keeps failing, the circuit would trip, which would be a sample for client side circuit breaker. In the real world,

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Sanjiva Weerawarana
This is almost kinda like that stupid new Java8 thing of "we removed null by wrapping it in a fancy object" ;-). On Thu, Mar 31, 2016 at 8:32 AM, Sanjiva Weerawarana wrote: > So this is not what I expected the real use case to be ... this is > basically a fancy try catch. > >

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Sanjiva Weerawarana
So this is not what I expected the real use case to be ... this is basically a fancy try catch. Don't we want to show a client side example? On Thu, Mar 31, 2016 at 6:28 AM, Afkham Azeez wrote: > Timeout is related to the actual operation taking more time than > anticipated. In

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Afkham Azeez
Timeout is related to the actual operation taking more time than anticipated. In such a case, without waiting indefinitely, the operation times out and the fallback of the Hystrix command will be invoked. The circuit will be open for a fixed period of time configured by

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Harshan Liyanage
Hi Azeez, Does this timeout in open state occurs in exponentially (first timeout in 10 secs, next in 20 secs etc) or linearly when transitioning back to half-open state? For example if the state is in "Open" and now the timeout (lets say 10secs timeout) occurs. Then the state is moved to

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-30 Thread Afkham Azeez
I have written a sample which demonstrates circuit breaker in action; http://blog.afkham.org/2016/03/microservices-circuit-breaker.html On Sat, Mar 12, 2016 at 6:09 PM, Afkham Azeez wrote: > This is a feature supported by some microservices frameworks. On the > server side, in

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-14 Thread Sanjiva Weerawarana
Azeez IMO just because anyone has it is not a good enough reason to do it. We need to be 100% clear about the problem something solves. We started MSF4J with that approach - not just to create an alternative! Sanjiva. On Mon, Mar 14, 2016 at 12:26 AM, Afkham Azeez wrote: > We

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Afkham Azeez
On Mon, Mar 14, 2016 at 7:18 AM, Lakmal Warusawithana wrote: > Hi Azeez, > > Without server side circuit breaker, can't we achieve this simply in load > balancers? See nginx "Passive Health Monitoring". It has implemented this > into some level. > Yes, it can be achieved to a

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Afkham Azeez
On Mon, Mar 14, 2016 at 7:41 AM, Lakmal Warusawithana wrote: > Actually even client side circuit breakers are not going to work, if we > fronted micro services via LB. > Cct breakers work within time time windows, and within a time window, if many calls failed, the client side

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Lakmal Warusawithana
Actually even client side circuit breakers are not going to work, if we fronted micro services via LB. On Mon, Mar 14, 2016 at 7:18 AM, Lakmal Warusawithana wrote: > Hi Azeez, > > Without server side circuit breaker, can't we achieve this simply in load > balancers? See nginx

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Lakmal Warusawithana
Hi Azeez, Without server side circuit breaker, can't we achieve this simply in load balancers? See nginx "Passive Health Monitoring". It has implemented this into some level. My point is all these micro services going to be fronted by a load balancers and if clients not implementing client side

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Afkham Azeez
We are not leaving out anything. We are in the process of implementing circuit breaker, bulkhead, timeout. Basically, core features people look for when evaluating microservices frameworks. We have started with circuit breaker. Thanks Azeez On Sun, Mar 13, 2016 at 6:57 PM, Frank Leymann

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-13 Thread Frank Leymann
I do have a more general question: what justifies the focus on the "circuit breaker" pattern at all? It is just one patter to solve recurring problems with stability, i.e. other patterns are there too that are important (e.g. "timeout" - see Michael Nygard's nice book). Thus, what are the

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-12 Thread Aruna Karunarathna
On Sat, Mar 12, 2016 at 6:16 PM, Afkham Azeez wrote: > Isabelle & Sanjiva, > > http://www.javaworld.com/article/2824163/application-performance/stability-patterns-applied-in-a-restful-architecture.html?page=2 > which Aruna had given as a reference explains circuit breaker on the

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-12 Thread Afkham Azeez
Isabelle & Sanjiva, http://www.javaworld.com/article/2824163/application-performance/stability-patterns-applied-in-a-restful-architecture.html?page=2 which Aruna had given as a reference explains circuit breaker on the server side. IMO, circuit breaker on both client side & server side are useful

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-12 Thread Afkham Azeez
This is a feature supported by some microservices frameworks. On the server side, in this case MSF4J runtime, failure counts are kept track of and then if the failures exceed certain thresholds, the circuit trips and rather than dispatch to the service, it returns service unavailable. Can you

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-11 Thread Sanjiva Weerawarana
I don't understand what server side circuit breaker means. How does the server adjust itself? Where's that bit of logic running? IMO this is not needed in a container world. On Fri, Mar 11, 2016 at 4:38 PM, Afkham Azeez wrote: > Yes, that is client side circuit breaker. What

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-11 Thread Afkham Azeez
Yes, that is client side circuit breaker. What Aruna is implementing is server side circuit breaker. Yes, we need both. On Fri, Mar 11, 2016 at 4:04 PM, Lakmal Warusawithana wrote: > Did you looked at [1] > > Netflix Hystrix is an incredibly

Re: [Architecture] Circuit Breaker Pattern for MSF4J

2016-03-11 Thread Lakmal Warusawithana
Did you looked at [1] Netflix Hystrix is an incredibly useful library for writing code that invokes remote services. Hystrix times out calls that exceed the specified threshold. It implements a *circuit breaker* pattern, which stops the client from waiting

[Architecture] Circuit Breaker Pattern for MSF4J

2016-03-11 Thread Aruna Karunarathna
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