Hystrix - intended for service consumer side only?

417 views
Skip to first unread message

joep...@jwhitesolutions.com

unread,
Aug 20, 2013, 6:58:45 PM8/20/13
to hystr...@googlegroups.com
Hello,

Give me a little license as I am new here.  Reading though the documentation on the hystrix wiki, it seems like the library is used primarily on the service consumer side (Although I have seen examples where a regular Java service is implemented using hystrix).  Has anyone used hystrix closer to a service endpoint (in a service implementation) or is the general idea to use hystrix at a lower level?

-Joe 

Ben Christensen

unread,
Aug 20, 2013, 8:12:22 PM8/20/13
to joep...@jwhitesolutions.com, hystr...@googlegroups.com
Hi Joe, 

Yes Hystrix is intended for use on the consumer side. Applications in distributed systems are often both producers and consumers, so it's not about the app being a "client" or "server" but about isolating a function being invoked that is accessing functionality that may be faulty or latent. Typically this means it's on the consumer end of a network call. 

Thus in general a HystrixCommand is intended to be invoked by the client-side of a client/server remote-procedure-call (RPC) relationship. You can see diagrams of an RPC client being migrated to expose functionality via Hystrix at https://github.com/Netflix/Hystrix/wiki/How-To-Use#migrating-a-library-to-hystrix to see where Hystrix ends up fitting in. Here is a very simple example in a playground app I'm messing with: https://github.com/benjchristensen/ws-finch/blob/master/finch-clients/finch-wikipedia-search/src/main/java/org/wsfinch/client/wikipedia/blocking/SearchWikipediaCommand.java

Whether the HystrixCommand is coded by the consumer, or delivered by the producer in a client library does not matter, it is invoked on the client-side of the RPC relationship.

If this general response does not answer the question, please elaborate with examples of what you meant by your question and I'll try again.

Ben



--
You received this message because you are subscribed to the Google Groups "HystrixOSS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hystrixoss+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Joe Public

unread,
Aug 21, 2013, 6:49:24 PM8/21/13
to Ben Christensen, hystr...@googlegroups.com
Ben,

Thanks for your answer.  This makes sense given the capabilities of the framework.  I really like the monitoring though.  In a scenario where my application/service is both a producer and consumer, it would be nice to capture metrics for the entire service execution (as a provider) as a whole in addition to its parts (the services that are consumed).  Can the monitoring portion be leveraged by itself for this purpose?

-Joe

Ben Christensen

unread,
Aug 29, 2013, 11:56:20 PM8/29/13
to Joe Public, hystr...@googlegroups.com
Ultimately you can wrap whatever you wish inside a HystrixCommand as long as it has a request/response.

If you only want the monitoring capabilities you can make it semaphore isolated, turn off the circuit breaker, set the max semaphore count high and have none of the isolation or fault tolerance benefits, just the monitoring.

-- 
Ben Christensen
+1.310.782.5511 @benjchristensen
Reply all
Reply to author
Forward
0 new messages