Search code examples
javathreadpoolhystrix

How hystrix creates their thread pool


My application is running in Websphere Application server. And I'm using Hystrix for some external service calls. The WAS server has a thread pool configuration, say a max thread pool size of 10 and the HystrixThreadPoolProperties maxCoreSize is set to 5.

I'm wondering how the threads are managed by hystrix. Does hystrix consumes 5 threads from the WAS server thread pool or will it create its own thread pool with 5 new threads which will result in a total of 15 threads.

In my case, I would want the hystrix to consume the threads from the WAS thread pool rather than creating new threads. Please advice.

Thanks in advance.


Solution

  • Hystrix, as all general purpose libraries, manages a thread pool on it’s own, but provides a way to plug in a custom thread pool or executor.

    In order to integrate Hystrix with a JavaEE server like WAS, you need to provide a concurrency strategy, which uses a managed executor to provide threads. In most JavaEE servers (I'm pretty sure that also in WAS), thread pool for a managed executor is different from the one used by HTTP threads by default - you still need to configure them separately or point both to use the same threadpool if the server supports it.