The bulkhead pattern

The bulkhead is the most common and basic pattern when we discuss isolation. The term itself has an interesting origin. The term is borrowed from cargo ships. A bulkhead is a wall built between different cargo sections in the ship. This wall ensures that if one of the sections gets flooded or catches fire, other sections do not get impacted. The idea is to build a similar partition between our services, so that failure in one area does not propagate to others.

We need to implement a bulkhead pattern at multiple levels, development as well as deployment. While developing, we need to make sure that we build our services in a manner that they are logically independent of each other. Moreover, while deploying, we need to make sure that we deploy each service independently so one node failure does not bring down all critical services.

Let's look at the following simple example to understand the power of the bulkhead pattern:

Say we have deployed multiple services in the same application server. Now, an application server can manage a fixed number of connections at a time. Say one of the services has buggy code, slowing it down, which results in blocking the threads for a longer duration. This will cause other services to suffer as they will not have adequate resources.

To tackle this, we need to use the bulkhead approach and create isolated blocks:

We have handled the scenario by isolating each service. Now, if one of the services gets into trouble and blocks all the threads, we will end up losing only one service and the other services will keep working fine.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.239.182