Architecture Intermediate
Bulkhead Pattern — Failure Isolation¶
BulkheadResilienceIsolation 3 min read
Resource isolation to prevent cascading failures. Thread pools, connection pools.
Principle¶
Like watertight compartments in a ship — if one compartment floods, the others stay dry. Each dependency gets its own resource pool.
Implementation¶
class BulkheadedService {
orderPool = new ConnectionPool({ maxSize: 20 });
paymentPool = new ConnectionPool({ maxSize: 10 });
async getOrder(id) {
return this.orderPool.execute(() =>
fetch('http://order-service/orders/' + id)
);
}
async processPayment(data) {
// Slow payment won't exhaust the order pool
return this.paymentPool.execute(() =>
fetch('http://payment-service/pay', { method: 'POST', body: JSON.stringify(data) })
);
}
}
Types¶
- Thread Pool Isolation — dedicated thread pool per dependency
- Semaphore Isolation — limiting concurrent requests
- Process Isolation — containers with resource limits
Summary¶
Bulkhead isolates dependency failures. Combine with Circuit Breaker for maximum resilience.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.