4 ms·
FWIW I have discovered a simple technique that solves this problem without any additional software: I create two or more services that are identical in all but
by ciconia 4y ago
FWIW I have discovered a simple technique that solves this problem without any additional software: I create two or more services that are identical in all but name, so instead of a `backend` service I'll have `backend1`, `backend2` etc.
When I need to restart the service, I do it in a staggered fashion, first stop and restart `backend1`, wait a few seconds, then stop and restart `backend2` etc. I put this in a script, works without any problem.
- m00dy 4y agoThis one has downtime right ?
- pankarol 4y agoIf you restart them one at a time, you always have at least one instance running.
- keeperofdakeys 4y agoIt would depend on the program. If you've got a load balancer in front, or they're receiving requests through a database or message queue, then there won't be an outage. Arguably anything where uptime is important should be setup this way. Upgrades can fail, and that will cause downtime anyway.
- whazor 4y agoCall them 'blue' and 'green', and you have blue-green deployments.
- hu3 4y agoSimple and ingenious. I like it! Do they use separate ports? Is there a load balancer to point to both services?
- comprev 4y agoThat's known as a blue-green deployment strategy and has been around since deployments began
- bobbiechen 4y agoUnlike the sibling comments, I would call this a rolling deployment: you are removing an old host and adding a new one at the same time when you restart. In a blue green deployment I would expect to see you add backend3 and backend4 with the updated code, and then rename services (or redirect traffic in some other way) to them. The difference is, if something goes wrong, backend1 and backend2 are hot standbys and we can revert the change by redirecting traffic back to them.