Bulkhead
Isolate resources like thread pools and connection pools into partitions so a failure or overload in one area cannot sink the entire system.
By Ratish Jain · Updated
Definition
The bulkhead pattern partitions resources — thread pools, connection pools, or service instances — so that each workload runs in its own isolated compartment. The name comes from a ship's hull, divided into watertight sections so one flooded compartment doesn't sink the vessel.
If one partition is exhausted by a slow or failing dependency, the others keep serving traffic.
The Problem It Solves
In a shared thread pool, a single slow downstream call can consume every thread while blocked. Requests to *healthy* endpoints then starve because no threads remain — one bad dependency takes down unrelated functionality.
Bulkheads cap the blast radius: the misbehaving workload can only exhaust its own compartment's resources.
How It Works
- 1Identify workloads or dependencies that should be isolated (e.g. critical vs. batch).
- 2Assign each its own resource pool — separate thread pool, connection pool, or instance group.
- 3Cap the size of each pool so it cannot borrow from others.
- 4Route each request type to its designated pool.
- 5When one pool saturates, requests to it queue or reject while other pools stay unaffected.
- 6Monitor per-pool utilization to tune sizes.
Bulkhead vs circuit breaker
They are complementary. A bulkhead limits how much damage a failing dependency can do by capping its resources; a circuit breaker stops calling it altogether. Production systems often use both together.
Tradeoffs
- Contains failures to a single partition.
- Protects critical workloads from noisy neighbors.
- Preserves partial availability under overload.
- Makes resource limits explicit and tunable per workload.
- Lower overall resource utilization (pools can't share).
- Requires capacity planning per partition.
- Too-small pools throttle legitimate load.
- More configuration and monitoring surface.
Interview Questions
A shared pool maximizes utilization but has no isolation: one slow dependency can block every thread, starving all other requests. Bulkheads sacrifice some utilization to guarantee that a failure stays contained to its own pool.
Base each pool on the dependency's expected concurrency and latency (Little's Law: threads ≈ throughput × latency), reserve headroom for critical paths, and monitor saturation to adjust. Critical workloads get generous, guaranteed capacity.
- →Partition resources into isolated compartments.
- →One saturated pool can't starve the others.
- →Named after watertight ship compartments.
- →Complements circuit breakers (contain vs. cut off).
- →Trades some utilization for fault isolation.
Related
Everything on Archprimer is connected — follow the graph.