Bulkhead Sizing: Balancing Isolation and Utilization
You'll learn how to determine the right bulkhead size to protect your system without wasting resources.
The Core Challenge
Setting bulkhead sizes is a balancing act. Too small, and you underutilize your resources—healthy requests get rejected even when capacity exists. Too large, and you lose isolation benefits—a single dependency's failure can still consume most of your resources and drag down the entire system.
Think of it like airplane seating sections. Make first class too small, and you leave revenue on the table. Make it too large, and when those passengers all need assistance simultaneously, your crew can't serve economy.
Factors That Drive Sizing Decisions
Expected Load: Start with your baseline traffic patterns. If Service A typically gets 100 requests/sec and Service B gets 20, their bulkheads should reflect this ratio—not equal splits.
Failure Scenarios: Model what happens when a dependency hangs. If your database query timeout is 5 seconds and you receive 50 req/sec, you need at least 250 threads in that bulkhead to handle requests piling up during an outage—but probably more for safety margin.
Acceptable Degradation: Define what "graceful" means. Can you afford to reject 20% of requests to one service to protect the other 80%? Your business priorities determine bulkhead boundaries.
Resource Constraints: You can't allocate more threads/connections than you physically have. If your server has 1000 threads total, and you have 5 dependencies, simple equal division (200 each) ignores reality—measure actual usage patterns instead.
The Sizing Process
Monitor production traffic → Identify peak concurrent requests per dependency → Add buffer (20-50%) for spikes → Validate total allocation doesn't exceed system capacity → Test under failure conditions.
Key Takeaway: Bulkhead sizing requires measuring real traffic patterns and failure modes—size for your worst-case dependency failure while leaving enough capacity for normal operations across all services.