Spring / Resilience4j Interview questions
How do you troubleshoot memory growth caused by an unbounded ThreadPoolBulkhead queue?
Check the configured queueCapacity first - if it's left very large or effectively unbounded while the downstream dependency is slow, incoming calls pile up in the queue faster than the pool can drain them, and each queued task holds onto memory (its captured state, any request payload) until it's finally executed or discarded.
Confirm this is actually the cause by watching the queue size and heap usage together over time during a slow-dependency period - a queue that keeps growing while heap climbs in step is a strong signal, versus a queue that plateaus at some bound while heap grows from an unrelated leak elsewhere.
The fix is almost always to bound queueCapacity explicitly to a size the application can tolerate, paired with a sensible maxThreadPoolSize, so that once the queue fills, further calls fail fast with a BulkheadFullException instead of accumulating indefinitely.
Pairing the bounded bulkhead with a CircuitBreaker also helps address the root cause rather than just the symptom, since it stops sending new calls toward the slow dependency once it's confirmed unhealthy, reducing pressure on the queue in the first place.
More Related questions...