Skip to content

Resilience patterns · 6 of 9

Step 1 · The pattern

One pool for every call

Checkout has ten workers. Each request takes one, calls PAYMENTS or RECOMMENDATIONS, and gives the worker back when the reply arrives. Any worker takes any call. Replies are quick, so about half the pool is in use.

  • payment call
  • recs call
  • answered

In short

Bulkheads: how it works and how it breaks

A service that calls other systems usually draws on one pool of workers or connections for all of them. Each call occupies a worker until the answer arrives. When one dependency turns slow, its calls stop finishing, so they collect in the pool until every worker is waiting on the same sick system. Calls to healthy dependencies then find no free worker and fail too. A bulkhead divides the pool, the way walls divide a ship's hull. Each dependency, or each class of work, gets its own small pool with a fixed cap. When one compartment fills, new calls for it are rejected at once, and no other compartment is touched. The broken feature still fails, but it fails quickly and alone. The cost is some idle capacity, because a busy compartment cannot borrow a spare worker from a quiet one.

In Spring Boot

A bulkhead per dependency with Resilience4j

application.yml + ReportClient.java
resilience4j.bulkhead:
  instances:
    reports:
      maxConcurrentCalls: 5
      maxWaitDuration: 0   # refuse at once when all five are busy

// ReportClient.java
@Bulkhead(name = "reports")
public Report build(ReportRequest req) {
  return http.buildReport(req);
}

At most five calls to the report service run at once. A sixth is refused immediately with a BulkheadFullException, so a slow report service can hold five threads and no more.

Gotcha: This default bulkhead is a semaphore: it caps how many calls run, but each still runs on the caller's thread and can take as long as it likes, so pair it with a timeout. The thread-pool type gives the dependency its own threads, and then the method has to return a CompletableFuture.

Names checked against the official docs on 15 Nov 2026:

How this comes up in interviews

"Checkout calls payments and recommendations from one pool of workers. Recommendations stops replying. What happens to payments, and how do you prevent it?"

Then they ask

  1. How do you size each compartment, and what does the isolation cost you?
  2. Should a full compartment borrow a spare worker from a quiet one? Why, or why not?
  3. What do separate pools inside one process still share, and when is that not enough isolation?

A strong answer covers

  • With one shared pool, calls to the slow dependency collect until every worker waits on it, and healthy calls find no free worker.
  • A bulkhead gives each dependency, or each class of work, its own small pool with a fixed cap.
  • A full compartment rejects new calls at once and no other compartment is touched, so the broken feature fails quickly and alone.
  • A bulkhead contains a fault and does not repair it, so the feature stays down until recovery or a fallback covers for it.
  • The cost is some idle capacity. Compartments must not lend to each other, or the slow dependency drains the neighbour too.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last updated: Official documentation

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.