Spring / Resilience4j Interview questions
What are the types of Bulkhead implementations?
Resilience4j offers two Bulkhead implementations, and choosing between them matters more than most other configuration decisions in the module.
| SemaphoreBulkhead | ThreadPoolBulkhead |
| Limits concurrent calls using a semaphore on the caller's own thread. | Runs calls on a separate, bounded thread pool with a queue. |
| Lower overhead, no thread hand-off. | Can time out/interrupt a stuck call since it runs elsewhere. |
| Blocks the calling thread while waiting for a permit. | Caller gets a CompletionStage back immediately. |
The Spring Boot annotation defaults to the semaphore variant; the thread-pool variant is selected with @Bulkhead(type = Bulkhead.Type.THREADPOOL), and it's the type required if you also want to pair Bulkhead with TimeLimiter to interrupt long-running calls.
More Related questions...