Skip to content
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

practical different between bulkhead vs threadpoolbulkhead #1367

Closed
ngDevendra opened this issue Mar 9, 2021 · 2 comments
Closed

practical different between bulkhead vs threadpoolbulkhead #1367

ngDevendra opened this issue Mar 9, 2021 · 2 comments
Labels

Comments

@ngDevendra
Copy link

ngDevendra commented Mar 9, 2021

Bulkhead -> Semaphore-based Bulkhead
ThreadPoolBulkhead -> Threadpool-based Bulkhead

The Semaphore-based Bulkhead runs your code in the current Thread and controls the number of concurrent threads by a Semaphore.
The Threadpool-based Bulkhead runs your code in a Thread from a Thread Pool and controls the number of concurrent threads by a bounded queue and thread pool.

Hi RobWin - Can you please explain this point with the help of example?

I've two downstream services which I want to call in a resilient manner i.e. Allow certain threads allocated to call to Service A and certain to call Service B. I understood the 'maxWaitDuration' and 'maxConcurrentCalls' very well. But not able to differentiate 'maxThreadPoolSize, coreThreadPoolSize, queueCapacity' from 'maxWaitDuration' and 'maxConcurrentCalls' ? Also can we use them together or we have to use either bulkhead or threadpoolbulkhead ? I gone through demo application but can't find the practical difference (or may be I'm not able to get it)

Also why ThreadPool bulkhead is only applicable for completable futures ? Please provide more details

@RobWin
Copy link
Member

RobWin commented Mar 9, 2021

maxWaitDuration and maxConcurrentCalls belong to the Semaphore-based Bulkhead -> https://resilience4j.readme.io/docs/bulkhead#create-and-configure-a-bulkhead

maxThreadPoolSize, coreThreadPoolSize and queueCapacity belong to the Threadpool-based Bulkhead -> https://resilience4j.readme.io/docs/bulkhead#create-and-configure-a-threadpoolbulkhead

I think it doesn't make sense to use them together. Use either of them.

@Romeh Romeh added the question label Mar 9, 2021
@ngDevendra
Copy link
Author

I understood that from documentation but few points are missing on documentation. So can you please help me with following queries:

  1. why ThreadPoolBulkHead is only applicable for CompletableFuture?

  2. In Threadpool-based bulkhead, coreThreadPoolSize number of threads will be ulitilised first, followed by requests will be queued and remaining requests (if any) will get extra threads which are more than coreThreadPoolSize and less than maxThreadPoolSize - is this understanding correct?

  3. We need to override all 3 maxThreadPoolSize, coreThreadPoolSize and queueCapacity properties if we want override defaultConfig. We can't override single property - is this understanding correct ?

@RobWin RobWin closed this as completed Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants