DEV Community

Andreas Jakof
Andreas Jakof

Posted on • Updated on

Reducing downtime using Azure Deployment-Slots

Disclaimer:
We have a (mostly) pure Microsoft environment. Having lots of virtual Windows Servers with IIS on them, serving our intranet pages. I don't know, if there is anything like WebDeploy with other Servers/IDEs.

There are several ways to deploy to the IIS.

They all are pretty simple and they all have the same drawback.
When you deploy, there is a downtime to your site. This might be okay, when deploying a WebSite, but when you have a heavily used API, you want to keep downtime to the absolut minimum. Preferably Zero, because you never know, when the next request will come. With bad timing it will be in the exact 500ms it took you to deploy the app.

I dont know an easy way around it, besides having a load balancer (or something similar) in front and at least two IIS instances.
But, with Azure, you have something called "Deployment Slots" and they come in handy.

You deploy to a deployment slot and (if configured) an automatic swap takes place. Your app is spun up and if successful, all new requests to your site/API are redirected to your new copy. As soon, as all requests to the old app are fulfilled, it is taken down and your new app is there to answer requests alone.

How can you use a Deployment Slot?
Configure a slot, to your site.
Deploy to it from your CD-Pipeline or any other way.

If you want, configure the Auto Swap as well... done.

Top comments (0)