Microservices consume distributed resources and the misbehavior or excessive load or failure of one services will affect consumers of the other services. This misbehavior could be because of a lot of reasons such as resource exhaustion or a lot of concurrent access to the resource.
For this we need to compartmentalize the calls or in another words we need to isolate the services. So to implement that we’re going to use bulkhead pattern.
Bulkhead pattern is used to isolate elements and in our case microservices into connection pools so that if a resource fails then it only affects that connection pool. Netfilx Hystrix uses this pattern to isolate dependencies from each other. You can read it Netflix-Hystrix
There’s a very nice article regarding how Bulkhead Isolation Policy is implemented in Polly(.NET resilience and transient-fault-handling library).
You can find it Polly-Wiki
A queue is used to limit the parallelization of execution. Following is the execution phase:
When implementing this pattern the most important analysis is to evaluate granularity of the bulkheads. Try to isolate the components that use a particular set of backend services. Moreover isolate critical components from standard components using this pattern.
To create more a sophisticated resilient application we need to group circit breaker and fallback patterns with the bulkhead pattern. Which we will talk in another blog post.