Spring / Resilience4j Interview questions
What is the difference between CircuitBreaker and Bulkhead?
CircuitBreaker and Bulkhead solve different problems even though both protect calls to a dependency: CircuitBreaker reacts to a dependency already failing or running slow, while Bulkhead limits how many calls can run concurrently regardless of whether they're failing at all.
A CircuitBreaker looks backward at recent outcomes to decide whether to keep sending traffic; a Bulkhead looks at the present moment and simply caps concurrency, rejecting or queuing extra calls once a limit is reached, even if every one of those calls would have succeeded.
They're commonly used together: Bulkhead prevents one dependency from monopolizing threads under normal-but-heavy load, while CircuitBreaker stops sending traffic once that dependency is actually unhealthy.
More Related questions...