Bulkhead pattern
In short: The bulkhead pattern separates resources so that the failure or overload of one part does not drag down the whole system.
In more detail: The name comes from shipbuilding: watertight bulkheads make sure a leak floods only one compartment. In software, every dependency or customer group gets its own resources, such as its own thread or connection pool.
In Depth
- Problem: If a service calls slow partners on a shared pool, the hanging requests eventually occupy every thread. After that, calls to healthy partners stall too.
- Solution: A separate, bounded pool per partner. When it is full, only calls to that partner fail.
- Variants: separate processes or containers, separate queues, separate database connections, quotas per tenant.
- Interplay: Together with a circuit breaker, timeouts and retries it forms the basic toolkit for resilience.
- Cost: Separate pools use hardware less efficiently, because free slots in one pool do not help another.
See also: Backpressure