-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hystrix 1.4 - Async/Non-Blocking [Preview] #209
Hystrix 1.4 - Async/Non-Blocking [Preview] #209
Conversation
Hystrix-pull-requests #68 SUCCESS |
@neerajrj I have some questions about NonBlockingCommand: private LatchedSemaphoreCommand(TestCircuitBreaker circuitBreaker, TryableSemaphore semaphore,
CountDownLatch startLatch, CountDownLatch waitLatch) {
super(testPropsBuilder().setCircuitBreaker(circuitBreaker).setMetrics(circuitBreaker.metrics)
.setCommandPropertiesDefaults(HystrixCommandProperties.Setter.getUnitTestPropertiesSetter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE))
.setExecutionSemaphore(semaphore));
this.startLatch = startLatch;
this.waitLatch = waitLatch;
}
@Override
protected Observable<Boolean> run() {
// signals caller that run has started
this.startLatch.countDown();
try {
// waits for caller to countDown latch
this.waitLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
return Observable.from(false);
}
return Observable.from(true);
}
} This is blocking inside the For example, in } catch (Exception e) {
/* execution time (must occur before terminal state otherwise a race condition can occur if requested by client) */
recordTotalExecutionTime(invocationStartTime);
observer.onError(e);
// empty subscription since we executed synchronously
} finally {
// pop the command that is being run
Hystrix.endCurrentThreadExecutingCommand();
}
} finally {
// release the semaphore
executionSemaphore.release();
} Am I correct that this unit test needs to change and put the latches inside an async |
changes to support non blocking behavior
- updated unit test that no longer worked with new Scheduler implementation
- open questions on this class
- they have outgrown the inner class model - I have made many things package accessible to make tests work - several are still breaking because they are accessing private members and I have not decided how to handle them
- all unit tests compiling - not all are passing as the RxJava 0.17 upgrade is still in process
RxJava 0.17 handles synchronous Subscriptions now so this code needed to be changed otherwise the exceptions never got thrown since the isUnsubscribed() would already be true.
Deriving the full class names for these inner classes was being done wrong and resulted in bad class names when the unit tests got moved.
This reveals the bugs in the current HystrixNonBlockingCommand implementation.
- unit tests are all passing with both async and sync Observables - defaults to semaphore isolation but allows thread isolation if an Observable source is synchronous
|
Whoops.
- Use "Operator" name as that's what it is. - Use HystrixObservableTimeoutOperator instead of TimeoutOperator so in a stacktrace it's clear it's the Hystrix variant and not the normal RxJava TimeoutOperator.
- all unit tests are now passing with semaphore and thread isolation
Hystrix-pull-requests #83 FAILURE |
Just pushed fixes for Work left to do:
|
Failing test |
Not quite sure why the |
Grrr, those tests fail when run from gradle, but not from within the IDE. |
Hystrix-pull-requests #85 FAILURE |
Fixed the |
Hystrix-pull-requests #89 FAILURE |
Update tests to assert isExecutedInThread true/false so we are sure the tests are getting what they expect.
Hystrix-pull-requests #90 SUCCESS |
Eliminate the AbstractHystrixCommand inheritance.
Hystrix-pull-requests #91 FAILURE |
Javadoc causes the build to fail? Really? |
... breaks things (thought nothing would implement this interface, but alas some things do).
Hystrix-pull-requests #92 FAILURE |
Fixes issue reported in #212 This was also fixed in 1.3.10
Hystrix-pull-requests #94 FAILURE |
with RxJava 0.17 soon upon us, do you have an estimate how far behind Hystrix 1.4 will be? Or will you want to get some bug fix releases off of 0.17 before moving Hystrix over? |
Theoretically Hystrix 1.4 is functional now and once RxJava 0.17 is released I am open to doing a beta release. I am not 100% certain this code is production ready though and due to the critical nature of this library I don't plan on releasing it officially until I've seen it running in our production environment for a while, and that is likely going to take us a couple weeks to finish doing. |
Very understandable. Thanks for the update! |
This is a preview of Hystrix 1.4 that adds
HystrixNonBlockingCommand
. Thank you to @neerajrj for this work!This will achieve issue #11.
The intent is to allow bulk-heading, circuit breaker and metrics support around non-blocking network calls. It will not use thread-isolation, only semaphore and timeouts.
Here is a simple example executing a network call via Netty:
This code is not final nor is the RxNetty library it's using ready, but it demonstrates the behavior of
HystrixNonBlockingCommand
.That are likely some things to change still before this is released and I am waiting until RxJava 0.17 (ReactiveX/RxJava#802) is released so Hystrix 1.4 will depend on it.
We have been running this on production canaries for several days to test existing code paths. That does not mean however that the new
HystrixNonBlockingCommand
is fully tested as our production systems are not yet using it.Please provide feedback on naming, design, etc.