1

We are using Azure webapp to host our app which is a mid-size Asp.net MVC application. the problem is that whenever we publish to that instance it takes so long (about 3min) for the first request to be responded.

I created some logs in Application_Start to measure when exactly this method is hit and how long does it takes, it showed that it takes ~20s for this method to execute (Ioc Container, AutoMapper,... warmup) but the weird part is the ~120s before Application_Start is called. I measured this by subtracting the time the first request is sent and the time the first log is created in Application_Start.

My question is what exactly happens at that time between restarting the webapp, sending the first request and hitting Application_Start of the webapp? is it related to the size of the app? (our app contains lots of references/subdirectories/...)

We are using P2V2 App Service Plan and two instances.

Eleboys
  • 53
  • 4
  • Possible duplicate of: https://stackoverflow.com/questions/54333062/slow-first-request-after-publishing-azure-web-app but warming up might be a solution for you problem: https://ruslany.net/2015/09/how-to-warm-up-azure-web-app-during-deployment-slots-swap/ – hujtomi Feb 28 '19 at 19:25
  • I am currently using but it just calls defined urls to warm them up but still is not a solution for the late running of Applicaion_Start. – Eleboys Mar 01 '19 at 10:27
  • Yes, it just calls the defined URLs, but in the real life, you usually do it on the staging slot, so, it is ok that the Applicaion_Start is slow, because it is staging, and once everything is warmed up, you swap the prod and staging slots, so, it will be fast on prod because it was already warmed up. – hujtomi Mar 01 '19 at 14:50
  • what about situations that I need to restart the application? – Eleboys Mar 05 '19 at 11:50
  • you mean on production? why would you restart a production system? in real life scenarios you don't really just restart prod systems, but if you want to do it you'll need many instances, then you can restart instances one by one: https://stackoverflow.com/questions/36917229/how-to-restart-azure-app-service-instance – hujtomi Mar 05 '19 at 23:27

0 Answers0