If I make changes in razor mode, recompile, or wait 15-20 minutes, the page may take 3 to 20 seconds to render on the first hit. I understand that the view must be recompiled after the change. I also understand that the application will be unloaded after a period of inactivity, but I thought it would be a one-time penalty for the very first strike. But for me it looks like every page.
Take, for example, my homepage. According to YSlow, this is a “B” with 15 components and a weight of 250K (including a hyperlink with optional jQuery for MiniProfiler). From MiniProfiler, I see about 500 ms on the first line (http: // localhost: 80). I assume this involves compiling the view. But then I see 1200 ms for Find: Index. No SQL calls. The total load time at the first hit is about 3000 ms, subsequent hits are about 40 ms.
On another page with several partial views, the parent view takes 2400 ms for "Find", one of the partial views takes 1000 ms for the search. The parent view also takes 3200 ms for the "Render". And the biggest impact on the first line (http: // localhost: 80 / User / Dashboard), which was a whopping 7000 ms. This page has only 3 requests with a total request time of 100 ms. The total boot time was more than 15000 ms. Subsequent hits are about 250 ms.
Our setup is ASP.Net MVC 3, Ninject, EF4.2, the Razor viewer, ELMAH, NLog, Html5Boilerplate and MvcMiniProfiler. I created a duplicate project and removed Ninject, ELMAH, NLog, and MvcMiniProfiler. Performance was only marginally faster. We have about 15 controllers and about 40 views, all in one area.
Is this normal performance? When we deploy Azure, this is even worse (naturally) than testing locally. Are there any suggestions for improvement?
Edit: The first hit after compiling to IIS / localhost (in release mode and with debug = false compilation) can be about 15 seconds. The Azure deployment running in the version has a faster first hit, but is still in the range of 5-10 seconds. I tried David Abbo's project, but did not see anything dramatic.