- Branch/Version: v3.0.1
- Environment: On-prem
Hi, we’re running Tyk Gateway in a blue/green kinda way to be able to do zero downtime deployments. When deploying a new version, we spin up a new container, wait until it’s ready, move traffic over and then shut down the old container. Since the old container might still be processing requests, what’s a good way you’d recommend to gracefully shut down the old container other than just waiting an arbitrary amount of time before stopping it? Docker sends a SIGTERM and my experience has been that it just kills the process. I wonder if there’s a better way.
A good way to do this is to have some sort of HA/load balancer in front of you gateway instances. You can then take an instance out of the load balancer and wait for a few minutes, then shutdown the gateway. SIGTERM is the correct signal to cleanly shutdown the gateway, but this will close any open connections and exit so ensuring that there is no incoming traffic is a good idea.
Ok thanks. I was hoping there would be a mechanism similar to uwsgi where the shutdown sequence waits until the request queue is depleted which is usually a bit quicker than waiting for a couple of minutes. But this works for us. Thanks.
Wondering if there are any updates around graceful shutdowns. Sending SIGTERM does indeed close the active connections of the gateway but looking for a way to have the active connections end before shutting down.
Was hoping that SIGUSR2 would cause the Tyk Gateway to spin off a new Tyk instance and wait for connections on the old instance to finish. It’s mentioned here that “This will fork and load a new process, passing all open handles to the new server and wait to drain the old ones.” but from looking at logs, the old process has a SIGTERM sent to it once the new instance is ready and that kills the active connections of the old instance.
In the end, we would like to be able to deploy the Tyk Api Gateway at any time without worrying about having any connections dropped. Is there any way to do this without having a wait?