Gracefully shutting down Tyk Gateway


  • 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.


1 Like

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.

1 Like