Bulkhead

Give each dependency or workload its own limited pool of resources, so one slow part can't use up everything and sink the whole service.

Description

A ship's bulkheads are watertight walls: one breached compartment floods, the others stay dry. In software, the compartments are separate pools of threads, connections, queue consumers or even whole service instances, one per dependency or per kind of work.

Without bulkheads, a slow recommendations API can tie up every connection in a shared pool, and checkout fails too because it can't get a connection. With them, recommendations get at most five connections; when those are busy, extra recommendation calls fail fast while checkout keeps its own twenty.

System design

Shop serviceproduct page1≤ 5 calls at once2pool full: fail fast3checkout4unaffected5Web appRecommendationspool: 5 connectionsCheckoutpool: 20 connectionsRecommendations APIslow right nowPayments API

Bulkhead system design diagram

  1. Web app (client).
  2. Recommendations (service): pool: 5 connections.
  3. Checkout (service): pool: 20 connections.
  4. Recommendations API (external service): slow right now.
  5. Payments API (external service).
  6. Step 1: Web app → Recommendations: product page.
  7. Step 2: Recommendations → Recommendations API: ≤ 5 calls at once.
  8. Step 3: Recommendations API → Recommendations: pool full: fail fast (failure path).
  9. Step 4: Web app → Checkout: checkout.
  10. Step 5: Checkout → Payments API: unaffected.
  1. Product pages ask for recommendations.
  2. Recommendation calls can use at most 5 connections from their own pool.
  3. The recommendations API is slow, the 5 connections stay busy, and extra calls fail fast. The page shows popular products instead.
  4. Meanwhile checkout requests use their own, separate pool.
  5. Payments keep working normally, because the slow dependency could never touch checkout's connections.
AWS
Separate connection pools per client in code; separate ECS services or Lambda reserved concurrency per workload.
Azure
Separate App Service plans or AKS node pools for critical work; Polly bulkhead policy in .NET.
Google Cloud
Separate Cloud Run services with their own max instances; GKE node pools and resource quotas.

When to use it

Use it when

  • A service calls several dependencies, and one being slow must not starve calls to the others.
  • Some work is critical (checkout, login) and some is nice-to-have (recommendations, analytics).
  • You serve several tenants or clients and one noisy one must not affect the rest.

Avoid it when

  • The service has one dependency and one kind of work. There's nothing to isolate.
  • Resources are so tight that splitting them leaves every pool too small. Scale first.

Pitfalls

  • Pool sizes picked by guesswork. Measure normal concurrency per dependency and size pools with headroom.
  • Isolating threads but sharing something else, like one database or one rate limit. The weakest shared resource sets the real compartment.
  • No fallback when a compartment is full. Decide what users see: a cached result, a default, or a clear error.

Alternatives

Circuit Breaker

Choose it when you want to stop calling a failing dependency entirely. Often combined with bulkheads.

Throttling

Choose it when you need to limit how much load clients send to you, rather than how much you send to dependencies.

Queue-Based Load Leveling

Choose it when the slow work can happen later, off the request path.

Separate deployments

Choose it when the strongest bulkhead: run critical and non-critical workloads as separate services or clusters.