Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Precompilation and startup times on ASP.Net

I am developping a (relatively small) website in ASP.Net 2.0. I am also using nAnt to perform some easy tweaking on my project before delivering executables. In its current state, the website is "precompiled" using

aspnet_compiler.exe -nologo -v ${Appname} -u ${target}

I have noticed that after the IIS pool is restarted (after a idle shutdown or a recycle), the application takes up to 20 seconds before it is back online (and Application_start is reached).

I don't have the same issue when I am debugging directly within Visual Studio (it takes 2 seconds to start) so I am wondering if the aspnet_compiler is really such a good idea.

I couldn't find much on MSDN. How do you compile your websites for production?

like image 656
Luk Avatar asked Sep 11 '08 11:09

Luk


2 Answers

Make sure that:

  1. You are using a Web Application project rather than a Web Site project, this will result in a precompiled binary for your code behind
  2. You have turned off debug code generation in the web.config file - I guess if this is different to when you used aspnet_compiler the code may be recompiled

If you've tried those, you could maybe try running ngen over your assembly thus saving the JIT time?

like image 168
Simon Steele Avatar answered Oct 18 '22 07:10

Simon Steele


For ultimate reponsiveness, don't allow your app to be shutdown.

The first method is to make sure that it's incredibly popular so that there's always someone using it.

Alternatively, fetching a tiny keep-alive page from somewhere else as a scheduled activity can be used to keep your site 'hot'.

like image 4
Steve Morgan Avatar answered Oct 18 '22 08:10

Steve Morgan