The metaphor
A ship is divided into bulkheads so a breach in one compartment does not sink the whole vessel. In software, bulkheading isolates resources so a failure in one part cannot starve the rest.
The failure it prevents
A single shared thread pool is dangerous. If one slow dependency holds many threads while waiting, healthy requests starve and the whole service stalls. This is resource exhaustion by a noisy dependency.
How bulkheads isolate
- Give each dependency its own pool of threads or connections.
- Cap how much each pool can grow.
- When one pool is exhausted, calls to that dependency fail fast while others keep flowing.
Now a stall in dependency A consumes only pool A. Requests that need dependency B continue normally. Bulkheads pair well with timeouts and circuit breakers to shed the stuck calls quickly.
Key idea
Give each dependency its own resource pool so one slow dependency cannot starve the whole service.