2

I am using ratpack, together with ratpack-hystrix, and have something akin to the following:

return RxRatpack.promiseSingle(
    new HystrixObservableCommand<List<VersionedArtifactMetadata>>(
        HystrixObservableCommand.Setter.withGroupKey(GROUP_KEY).andCommandKey(
          HystrixCommandKey.Factory.asKey("search"))) {
            @Override
            protected Observable<List<VersionedArtifactMetadata>> construct() {
              return RxRatpack.observe(
                Blocking.get(() -> {
                  return httpClient.request(...);
                }
            }
          }.toObservable());
    ));

What does the execution look like? I assume that, given the integration between Promise and Observable that they seamlessly share the same non-blocking thread pool? How does Hystrix integrate with said thread pool?

Is this my understanding correct when I say that given the scenario above I have the following:

  • A thread pool for managing non-blocking work (for both Promise and Observable)
  • A Hystrix thread pool
  • A thread pool for managing blocking work (for both Promise and Observable)
  • A HTTP connection pool

When the code above is executed, does it first create a Promise (on the blocking thread pool), convert that to a observable (still executed on the blocking thread pool), wrap that in a Hystrix command (executed on the Hystrix thread pool), wrapped in an Observable (executed on the non-blocking thread pool), wrapped in a Promise (still executed on the non-blocking thread pool). Is that right?

Also, how do I size the various thread pools in relation to each other? Does the Hystrix one need to be a certain size compared to the Ratpack ones?

Thanks!

Anvar
  • 1,110
  • 2
  • 10
  • 22

0 Answers0