Netflix / Hystrix

Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
24.15k stars 4.71k forks source link

Asynchronous Executables #11

Closed benjchristensen closed 10 years ago

benjchristensen commented 12 years ago

Support wrapping asynchronous clients and network access.

Concepts right now are HystrixSelector and/or HystrixFuture objects that could wrap asynchronous calls.

Thread isolation would obviously not make sense in these cases, but semaphore isolation to limit concurrent access, timeouts (such as an existing Future.get being wrapped), callback timeouts, circuit-breakers, metrics, monitoring, properties all make sense.

codefromthecrypt commented 11 years ago

right. in this I can see that HystrixCommand.execute needs to be able to decorate a future

could use guava Futures.transform to help here

benjchristensen commented 11 years ago

The intention here is to provide first-class support of dependencies that are already asynchronous (Futures, NIO, etc). There would still be queue() and execute() methods on these new top-level objects (HystrixFuture or HystrixAsyncCommand, HystrixSelector, etc).

All of them would implement HystrixExecutable like HystrixCommand does (https://github.com/Netflix/Hystrix/blob/master/hystrix-core/src/main/java/com/netflix/hystrix/HystrixExecutable.java) with execute() and queue().

The HystrixCommand.execute() method doesn't really get involved in this - it is a public API method that provides a blocking call to what is generally a asynchronous execution (using thread isolation, not semaphore), the equivalent of queue().get().

codefromthecrypt commented 11 years ago

Ahh cool. That works!

johngmyers commented 11 years ago

If you accept a dependency on RxJava, then I would question the need for these new top-level objects to implement HystrixExecutable. If the new top-level object returns an Observable, the caller could use Observable.single() to collapse it into a synchronous call.

rore commented 11 years ago

+1 for this feature.

amangup commented 11 years ago

is this is in development now?

neerajrj commented 11 years ago

Yes we are actively working on it. I don't have a firm ETA yet though

On Thu, Oct 24, 2013 at 4:28 AM, amangup notifications@github.com wrote:

is this is in development now?

— Reply to this email directly or view it on GitHubhttps://github.com/Netflix/Hystrix/issues/11#issuecomment-26984519 .

siddharthsa commented 10 years ago

Hi, We are eagerly waiting for this to be released. When can we expect this to see the light of the day?

benjchristensen commented 10 years ago

It's sitting in my TODO list to do a code review. Theoretically it's functional and coded but not reviewed or fully tested.

benjchristensen commented 10 years ago

Are you interested in reviewing and testing if we share it publicly?

amangup commented 10 years ago

Yes....we should will be able to test and review it. Thanks!

siddharthsa commented 10 years ago

Hi Ben, We can test and review it. But we would like to understand from you how detailed testing you want and also for code review part it would be better if someone more experienced with hystrix also take a look at it.

benjchristensen commented 10 years ago

I'm still the bottleneck on this. I hope to catch up in the coming weeks as I have a few things waiting on this.

yngbldjr commented 10 years ago

Bump... What's the status on this? I would also be interested in this feature as well as testing with a asyn framework like vertx.io. I love a the built in functionality of Hystrix, and would like to utilize it in a existing vertx application to provide the much needed metrics and dashboards.

benjchristensen commented 10 years ago

We are canary testing Hystrix 1.4 in production with these changes. The most significant work is now complete. Before releasing I need to do some further refactoring to clean some things up and another round of larger production canary testing. I imagine it's still several more weeks, but no longer months before it's releasable.

Once we hit our production canary status I could publish a release candidate (1.4.0.RC1) if that interests you?

yngbldjr commented 10 years ago

Yes, that would be great. Hystrix is a great framework and being able to leverage it in existing code would be something I would be interested in. Thanks for the reply, and appreciate the work.

hartzler commented 10 years ago

+1 would love an early peek at this as well!

benjchristensen commented 10 years ago

I just posted a pull request with the current state of this code.

yngbldjr commented 10 years ago

Awesome! Thanks!

p14n commented 10 years ago

Cheers Ben - looks good. Used this to create an example of Hystrix with vert.x, found no issues. https://github.com/p14n/vertx-hystrix

benjchristensen commented 10 years ago

Thanks for taking the time to review. There are a few issues I'm still working on so it's not yet ready for production.