Bulkheads and Isolation
You'll learn how to partition system resources so that failures in one area don't sink the entire ship.
What Are Bulkheads?
The term "bulkhead" comes from shipbuilding. Ships are divided into watertight compartments by bulkheads—vertical walls that prevent water from flooding the entire vessel if the hull is breached. If one compartment floods, the others remain intact, keeping the ship afloat.
In software, bulkheads are resource partitions that isolate different parts of your system. By dedicating separate resource pools (threads, connections, memory, CPU) to different subsystems or clients, you prevent one failing or misbehaving component from exhausting shared resources and bringing down everything else.
Why Isolation Matters
Without bulkheads, a single subsystem experiencing problems—say, a slow database query or a spike in traffic from one client—can consume all available resources. Your thread pool fills up, connection limits are hit, and suddenly every operation in your system fails, even unrelated ones.
With bulkheads, you contain the blast radius. If Service A's dedicated thread pool is exhausted, Service B continues operating normally with its own isolated resources.
Practical Example
Imagine you have a web application that talks to three external APIs: payments, notifications, and analytics. Without bulkheads, all three share a 100-thread pool. If the analytics API becomes slow, those threads hang waiting, eventually exhausting the entire pool. Now payment requests fail too—a disaster.
With bulkheads, you allocate 40 threads to payments, 40 to notifications, and 20 to analytics. When analytics slows down, only its 20 threads are affected. Payments and notifications keep processing normally.
Key Takeaway: Bulkheads partition resources into isolated pools, preventing one subsystem's failure from consuming shared resources and cascading to the entire system—containing failures at their source.