Azure App Service swap takes over multiple times longer than a direct deploy

Viewed 5255

I have a very simple asp.net core hosted blazor wasm application on a S1 App Service with 2 slots: Integration and production. When I just publish into my integration slot that takes around 50 seconds. But when I swap the integration with the production slot it takes over 7 minutes. Both apps slots are after that very slow, often taking over a minute before they react again. During the swap both are not responding at all.

There are only 2 settings and the connection string to change. And I don't have any manual warmup. Is the swap functionality just not really meant the be used on such a low configuration or can I adjust something in my configuration to speed things up?

1 Answers

Adding some information here regarding Azure App service deployment slot swap might be helpful:

Some apps might require custom warm-up actions before the swap. The applicationInitialization configuration element in web.config lets you specify custom initialization actions. The swap operation waits for this custom warm-up to finish before swapping with the target slot.

During the swap operation the Web App’s worker process may get restarted in order for some settings to take effect. Even though the swap does not proceed until the restarted worker process comes back online on every VM instance, it may still not be enough for application to be completely ready to take on production traffic.

Try enabling Application Initialization Module to completely warm up your application prior to swapping it into production.

More detailed explanation of that process is available at How to warm up Azure Web App during deployment slots swap

To add to this if the swap operation takes a long time to complete, you can also get information on the swap operation in the activity log. On your app's resource page in the portal, in the left pane, select Activity log. A swap operation appears in the log query as Swap Web App Slots. You can expand it and select one of the sub operations or errors to see the details.

Please refer to below links for more details on this:

https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#what-happens-during-a-swap

https://ruslany.net/2017/11/most-common-deployment-slot-swap-failures-and-how-to-fix-them/

https://ruslany.net/2019/06/azure-app-service-deployment-slots-tips-and-tricks/

Related