For resilient distributed system , we have actually 2 patterns , CircuitBreaker and BulkHead .
As circuitBreaker needs to be built at clientSide from where the faulty dependency needs to be called . This will return the default output of faulty one without calling it in case of any outage and avoid calling the faulty dependency , So no new thread will be occupied at that particular point of time .
But in Bulkhead , we have already divided the numberOfThreads on the basis of downstream dependencies and in case of outage , that portion of threads will be blocked , but it'll not be able to use rest of the thread pool. So , the newer threads will be occupied until the proportion is totally occupied .
So , As circuit Breaker , we don't invest threads , but in bulkhead a particular number of threads atleast be invested during the outage .
Q-1. why bulkhead pattern is needed ? Do someone really need to use Bulkhead. If we keep in mind the new thread consumption point during outage . Can someone please trace out some positive points of BulkHead over CircuitBreaker.
Q-2. In this post mentioned that bulkHead needs to be implemented in the service which is being called(faulty service). I really not able to understand , how the faulty dependency/service would be able to divide the threads for itself . In my opinion , the service which is calling the faulty one , should have divided the threads for each downstream dependency including the faulty one. Can someone please clarify .
Q-3. Can someone share some code-references for how they have divided the threads for downstream services while using BulkHead.
Aucun commentaire:
Enregistrer un commentaire