What do we need to warmup before swapping apps service slots?

Greg Yvkoff 151 Reputation points
2022-08-24T15:09:53.503+00:00

Currently we deploy changes to our app services during off hours, but want to now take advantage of slots so we can deploy during business hours. After slot deployment, I want to warm up the app to avoid cold start after the swap. What exactly needs to happen for the slot to officially be "warm"? The app service mainly does database queries/updates. Do I need to initiate a call to each instance of SQL?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,879 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 16,011 Reputation points
    2022-08-25T18:00:48.053+00:00

    Hi @Greg Yvkoff ,

    Thanks for your question. If I understand correctly, you want to know what needs to happen for the slot to be "warm" completely?

    Adding to AndriyBilous response and the thread he referenced- to ensure the slot is warmed up completely use the Application Initialization Module to warm up the slot prior to swapping it into production. 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. Here's a sample web.config fragment from the azure doc:

    <system.webServer>  
        <applicationInitialization>  
            <add initializationPage="/" hostName="[app hostname]" />  
            <add initializationPage="/Home/About" hostName="[app hostname]" />  
        </applicationInitialization>  
    </system.webServer>  
    

    You can also customize the warm-up behavior with one or both of the following app settings:

    -WEBSITE_SWAP_WARMUP_PING_PATH: The path to ping over HTTP to warm up your site. Add this app setting by specifying a custom path that begins with a slash as the value. An example is /statuscheck. The default value is /.

    -WEBSITE_SWAP_WARMUP_PING_STATUSES: Valid HTTP response codes for the warm-up operation. Add this app setting with a comma-separated list of HTTP codes. An example is 200,202 . If the returned status code isn't in the list, the warmup and swap operations are stopped. By default, all response codes are valid.

    -WEBSITE_WARMUP_PATH: A relative path on the site that should be pinged whenever the site restarts (not only during slot swaps). Example values include /statuscheck or the root path /.

    You can also check out this blog post on How to warm up Azure Web App during deployment slots swap

    Hope that helps. Please let us know if you have further questions

    Thanks,
    Grace

    ------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answer--