0
0
Microservicessystem_design~12 mins

Bulkhead pattern in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Bulkhead pattern

The Bulkhead pattern is used in microservices to isolate failures and limit the impact of faults in one part of the system. It divides the system into isolated compartments (bulkheads) so that if one service or resource fails or becomes slow, it does not bring down the entire system.

This design improves system resilience and availability by preventing cascading failures.

Architecture Diagram
          +------------+          +------------+          +------------+
          |  Client A  |          |  Client B  |          |  Client C  |
          +-----+------+          +-----+------+          +-----+------+
                |                       |                       |
                v                       v                       v
          +-------------------------------------------------------------+
          |                       Load Balancer                        |
          +-------------------+-------------------+------------------+
                              |                   |                  
                  +-----------+           +-------+--------+         
                  | Bulkhead 1 |           | Bulkhead 2    |         
                  | (Service A)|           | (Service B)   |         
                  +-----+-----+           +-------+------+         
                        |                         |                 
               +--------+--------+        +-------+-------+         
               | Circuit Breaker |        | Circuit Breaker|         
               +--------+--------+        +-------+-------+         
                        |                         |                 
               +--------+--------+        +-------+-------+         
               |  Database A     |        |  Database B   |         
               +-----------------+        +---------------+         
Components
Client A
client
Sends requests to the system
Client B
client
Sends requests to the system
Client C
client
Sends requests to the system
Load Balancer
load_balancer
Distributes incoming requests to different bulkheads
Bulkhead 1 (Service A)
service
Handles a subset of requests isolated from other bulkheads
Bulkhead 2 (Service B)
service
Handles another subset of requests isolated from other bulkheads
Circuit Breaker (Bulkhead 1)
circuit_breaker
Prevents cascading failures by stopping calls to failing service
Circuit Breaker (Bulkhead 2)
circuit_breaker
Prevents cascading failures by stopping calls to failing service
Database A
database
Stores data for Service A
Database B
database
Stores data for Service B
Request Flow - 7 Hops
Client ALoad Balancer
Load BalancerBulkhead 1 (Service A)
Bulkhead 1 (Service A)Circuit Breaker (Bulkhead 1)
Circuit Breaker (Bulkhead 1)Database A
Database ABulkhead 1 (Service A)
Bulkhead 1 (Service A)Load Balancer
Load BalancerClient A
Failure Scenario
Component Fails:Bulkhead 1 (Service A)
Impact:Requests routed to Bulkhead 1 fail or slow down, but Bulkhead 2 and other parts of the system continue working normally.
Mitigation:Circuit breaker trips to stop calls to failing service; Load Balancer routes new requests to healthy bulkheads; system isolates failure impact.
Architecture Quiz - 3 Questions
Test your understanding
What is the main purpose of the Bulkhead pattern in this architecture?
ATo isolate failures so one service failure does not affect others
BTo speed up database queries by caching
CTo balance load evenly across all services
DTo encrypt data between services
Design Principle
The Bulkhead pattern divides a system into isolated compartments to contain failures. This prevents one failing service from cascading and affecting others, improving overall system resilience and availability.