krzykol
krzykol

Reputation: 25

Azure AppService repsonse slow after restart

I have an AppService with a WebAPI project on it. After I restart this service or upload new version, each of endpoints I first call are responding very slowly (>15sec). If I click through all the endpoints once, the application works fine.

My Azure has a PayAsYouGo Subscription and I have AlwaysOn feature of AppSercice set to true. In the trace logs I also saw multiple entries with:

SnapshotHelper::RestoreSnapshot - optout environment variable aspnet:PortableCompilationOutput=true

During compilation I'm using following parameters:

/p:PrecompileBeforePublish=true 
/p:UseMerge=true 
/p:SingleAssemblyName=AppCode

Upvotes: 0

Views: 256

Answers (1)

Bryan Roberts
Bryan Roberts

Reputation: 3479

The problem is that your Azure instance has not been called for the first time. You need to use an application warm up process to get it going first. One way to handle this is by using application initialization module configured via your web.config during swaps and deployments.

This allows you to call a page in your site as part of the startup process after you do your deployments.

<system.webServer>  
  <applicationInitialization>  
    <add initializationPage="/warmup-cache.php" hostName="appinitwarmup.azurewebsites.net"/>  
  </applicationInitialization>  
</system.webServer>

Upvotes: 2

Related Questions