Spring / Resilience4j Interview questions
When would you choose a RateLimiter over a Bulkhead for protecting a downstream call?
Choose RateLimiter when the actual constraint you're protecting against is expressed as a rate - a third-party API that documents "100 requests per minute", or a downstream system whose own capacity planning is expressed in requests-per-second, not in how many requests can be in flight at once.
Bulkhead is the better fit when the real risk is resource exhaustion on your own side - a slow dependency holding onto threads or connections long enough that unrelated calls elsewhere in the application start starving, regardless of how many requests per second are actually going out.
A practical signal for which one you need: if the dependency's own docs or SLA quote a numeric rate limit, reach for RateLimiter; if you're the one worried about your application's own thread pool getting exhausted by one misbehaving dependency, reach for Bulkhead - and it's common to apply both together when both concerns exist simultaneously.
More Related questions...