Bulkheads

Per-dependency thread pools, the ship-bulkhead analogy, and how Hystrix popularized the pattern.

Overview

The ship analogy

Bulkheads are an isolation pattern from Michael Nygard's *Release It!* (2007). A ship's hull is divided into watertight compartments, so a hole in one does not flood the whole ship.

In software, you isolate resource pools so a failure in one cannot exhaust the whole service's capacity. Picture Service A calling three dependencies, B, C and D. Instead of one shared pool, A gives each dependency its own pool of 30 threads and keeps 10 threads in reserve. When Service B turns slow, the 30 threads in B's pool block while they wait on it, and the C and D pools keep serving their calls.

> [!IMPORTANT] With bulkheads, one sick dependency degrades one feature instead of taking the whole service down.

Key concepts

  • Bulkhead pattern
  • Thread isolation
  • Semaphore isolation
  • Connection-pool bulkheads
  • Hystrix legacy
  • Combined with circuit breaker

Interview questions

  • How do bulkheads differ from circuit breakers?
  • Walk me through configuring a bulkhead for a database connection pool.
  • When are bulkheads NOT worth it?

Sign up free to read the full topic

More SRE topics

Start free on Cariara · Coding problems · System design studio