Upgrade micro-service without breaking current execution

5/29/2018

Suppose you have a micro-service architecture with a topology of two services A and B on which both has 3 instances running each.

A its a web service receiving web requests, and B its a cli based application listening for events from a queue

Now you want to deploy a new version of B, but since the instances of B can be processing info at the moment.

How can be deployed, replacing old instances for new ones without breaking current execution?

There is any tool, patterns or strategy that handle this scenarios?

-- bitgandtter
containers
docker
kubernetes
microservices

1 Answer

3/31/2020

You need a simple strategy where you stop serving new requests for B for that instance which is about to go under deployment. If it's consuming events using rest then you can use load balancer, if you have load balancer then using consul, consul template you can detach that instance from load balancer. Keep some approx time say 5 mins (which you need to evaluate) and then start the deployment. Using this approach is necessary if you are not sure how to find out if the current instance has done all the processing of existing events. If these events are consumed using MQ then you can have an endpoint upon called which will disable the new event consumption. And then have the same wait and deploy strategy.

-- TonyStark
Source: StackOverflow