3

So I am running ASP.NET MVC 5 hosted on Azure. I am suffering like so many other people for a slow down on the first request. On my local IIS it even takes 10 minutes. On the local IIS Express using by VS it takes approximately 1 min. Publishing on Azure and viewing the first page takes approx 2 mins and then other pages from then on wards take approx 30 seconds each. Of course once the page loads the first time, other requests are fine.

So these are the things which I tried to change to see if I manage to fix things on my local IIS since I am trying to test on that one.

  1. Compilation Debug set to false
  2. Precompiling did not work
  3. Precompiling and merging in one assembly did not work too
  4. Tried to add an empty View and a controller which returns the View and still slow
  5. Am running also an API against the same DAL and Business Layer and it does not load slow (approx. 15 seconds to load first time). This means this is not an issue of the DB Model which is Entity Framework since it is using the same code.

Any idea how I can debug and see why it is so slow to load the first time. Other requests are then fine.

Running IIS version 10.

Thanks

Mark Farrugia
  • 87
  • 2
  • 9
  • Looks like you have something executing at startup. In that case, it doesn't matter whether your controller/view is empty/dummy or not. – Artak Jan 21 '19 at 17:59
  • I don't think so :(, since this happens every time I open any page the first time. Maybe I was not clear enough. – Mark Farrugia Jan 21 '19 at 18:14
  • @MarkFarrugia can you check if this delay happens after an IIS recycle? If so, you can try this approach: https://serverfault.com/questions/590865/how-can-i-warm-up-my-asp-net-mvc-webapp-after-an-app-pool-recycle – Tiago B Jan 21 '19 at 18:30
  • Hi @TiagoBrenck unfortunately I tried recycling etc and installed Appllication Initialization module. And even if it was the application should not take 10 mins to start the app.... when it gets recycled. – Mark Farrugia Jan 21 '19 at 20:45
  • The comment by @Artak deserves more investigation for you. It doesn't matter "what page" you view for the first time since something that is executed the _first time your application starts up_ runs regardless (of any page that is being requested). – EdSF Jan 21 '19 at 21:51
  • Additionally `15 secs` (initial) load time for your db stuff _is very slow_ - there's definitely something to that as well – EdSF Jan 21 '19 at 21:52
  • @edsf when I said 10 to 15 seconds I was not referring to any db calls since yes if I was doing a db call that takes 15 seconds it would be too much. What I was referring to is just loading the API help page that Asp.net automaticaly generates for the API calls so there are no db calls in any way. – Mark Farrugia Jan 22 '19 at 18:12
  • Unfortunately, I can't guess for you. All I can say is `15 secs` startup is very slow, so all the other comments above indicate something out of the ordinary. My basis? I'm on Azure myself MVC5 (and WebAPI, not that it should matter), nothing fancy. A "cold start" delay is something in the 2 - 3 sec range (if). – EdSF Jan 22 '19 at 18:21
  • @MarkFarrugia probably less relevant to the IIS side of things, however, would like to add our team was using MVC5 and 4.7.x was extremely slow compared to 4.5/4.6.x/4.8. – petrosmm Dec 26 '19 at 15:19

1 Answers1

0

Consider trying Application Initialization to warm up the pages you want. Refer to Application Initialization and How to warm up Azure Web App during deployment slots swap for more details.

If Application Initialization is still not working, you can try to enable Failed Request tracing. FREB log contains the whole lifecyle of a request with execution time. It's useful to help investigate which part takes long time. Sample picture: enter image description here

Refer to here to understand how to troubleshoot with FREB log.

If still no luck, I'm afraid you need to seek for help from Microsoft support team.

axfd
  • 291
  • 1
  • 6
  • Many thanks for this. I spoke to Microsoft. They came with a solution to use Deploment slots which is not 100% right since you would have to consume server resources to host the 2nd app. I am doing something very similar but on a seperate server and then manage the redirections using Traffic manager. I am pretty sure Application Initialization is installed on Azure IIS. – Mark Farrugia Jan 22 '19 at 10:10