다음을 통해 공유


How to optimize Azure App Service AlwaysOn, cold start, warm up request

When you enable AlwaysOn it means that the application pool will not be shutdown after the idle timeout threshold is breached.  I wrote about this threshold here and here.

The point here is that after a cold start of your application, AlwaysOn will send a request to the ROOT of your application.  Whatever file is delivered when a request is made to / is the one which will be warmed up.

If you wanted AlwaysOn to warmup a specific page instead of the root, then you can implement this URL Rewrite rule.

 
<?xml version="1.0" encoding="UTF-8" standalone="no">
<configuration>
    <system.webServer>
      <rewrite>
        <rules>
          <rule name="Rewrite AlwaysOn" stopProcessing="true">
            <match url="^$" />
            <conditions>
              <add input="{HTTP_USER_AGENT}" pattern="^AlwaysOn$" />
            </conditions>
            <action type="Rewrite" url="/api/Online/Ping" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
</configuration>
ue

You can add the text to the web.config for your Azure App Service or you can configure IIS Remote Administration for the App Service and create the URL Rewrite rule via the GUI (I like GUI).  I describe that here “Configure Remote IIS Administration for Microsoft Azure App Service” (this is no longer supported unfortunately...).

Comments