Warmup your application on Azure App service when scaling up and swapping slots using “Application Initialization”

A common problem on Azure web apps when scaling up or swapping slots is “stuttering”. At the moment an instance is added to the pool (scale out) or your swap is swapped (reload the app on the slot), your application is “cold , which means that your application on that instance needs to be reloaded. In the case of Sitecore (or other large applications), this may take a while. In this period, visitors may face a long loading time, which may take up to a few minutes.

This stuttering can easily be resolved for Azure App Services, making use of default mechanisms which isn’t widely used or known. This mechanism is called “Application Initialization“, which was introduced in IIS version 8:

“Application Initialization can start the initialization process automatically whenever an application is started.”

This process doesn’t make the startup process faster, but starts the process sooner.  The fun part is: when making use of scaling within Azure Apps, this mechanism can be used to warmup the specific new azure app service instances.

Within the web.WebServer section of the web.config, the Applicationinitialization node may be added. Within this node, the pages that need to be warmed can be specified over here:

      <add initializationPage="/" />
      <add initializationPage="/page-2" /> 

As stated previously, this action starts the process sooner, but doesn’t make it faster. This applies to normal IIS as well as Azure App Services. So after a restart, and you’d immediately try to visit that website, you would experience a long loading time. But the Azure App service has a cool feature. When scaling up (manually or by using autoscale) or swapping slots, a new instance is created and started. The initializationPages are being touched internally and Azure App Services waits with the actual swap or addition to the Azure App Service pool until all the pages which have been defined in that section, have been loaded. This will prevent that “cold” applications will not be released, which means that there will be no “stuttering” of the application.


4 thoughts on “Warmup your application on Azure App service when scaling up and swapping slots using “Application Initialization”

  1. cong ty skt

    Link exchange is nothing else but it is just placing the other
    person’s web site link on your page at appropriate place and
    other person will also do same in support of you.

  2. ZloGlaZ

    Please note that it should be node and not the .
    Morevoer, it is better to include a desired hostname otherwise “localhost” maybe cached sometimes:

  3. Andy Burns

    Interesting – any idea how well this works with multi-tenanted sites?

    Also, what about the reMapManagedRequestsTo attribute? Did you manage to get that working? Again, what about multiple tenants?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.