Ship's bulkheads: compartments so one flood doesn't sink the boat. Software bulkheads: thread pools per dependency so one slow service doesn't starve others.

Web appServing trafficShared pool500 threadsSlow service Asteals allFast service Bstarved!Bulkheadisolated poolsPool A: 100for service A onlyPool B: 100for service B onlyPool C: 100for service COne bad servicehurts only its pool
Bulkhead: dedicated thread pool per dependency = isolated failures
Advertisement

The problem

Shared thread pool. Slow service A hangs. All 500 threads waiting on A. Fast service B starved even though it's healthy.

The problem

Shared thread pool. Slow service A hangs. All 500 threads waiting on A. Fast service B starved even though it's healthy.

Advertisement

The fix

Pool per dependency. Service A's slowness only exhausts A's pool. B has its own threads.

Sizing pools

Baseline load × safety factor. Not so many that concurrent slowdowns kill the app. Not so few that spikes queue.

Semaphore vs thread pool

Thread pool: fully isolated + heavy. Semaphore: cheaper + shares main thread pool but limits concurrency per dependency.

Metrics per pool

Emit active + queued + rejected per pool. Alert on rejections + high queue depth.

Pool per dependency + monitor per pool. One slow service can't drag down everything else.