Iis – How to determine performance improvement from precompiling ASP.NET site

asp.netiisperformance

I have an ASP.NET (non-MVC) site that is deployed to IIS. I've setup the precompile options (for deploy/publish). Settings are below in the image. I've tried a variation of the settings below and from the surface, I'm not seeing any significant improvements from doing this. To test, I'm deploying a precompiled and a non-precompiled to two different IIS sites. I go in and recycle the app pool for each site (or IIS reset)… after doing that I hit both sites separately and they both take just as long to render the first page load (i.e. cache the app pools?), and then subsequent calls to other aspx pages take about the same amount of time (in precompiled vs non-precompiled). Am I missing something? Does the precompiling only work well for enormous sites? Mines a mid-sized site, that has API calls, DB calls, etc.

Are there specific settings that I need in place to improve load times for first hits to the site after app pool recycle? Or in general, improve first-hit response time to an aspx or ascx that hasn't been compiled yet?

Precompile Settings

Best Answer

Difference between "pre-compiled" and "not pre-compiled", is that the "not precompiled"'s site pages will get dynamically compiled upon first request to each of those pages by .net compiler (csc.exe/vbc.exe, you can actually see them popup in task manager's processes tab). So each page will take a one time hit of compilation time, though usually its negligible. If your website also has code files in /app_code directory, those will get compiled before web sites starts up as well, so initial start up should be slightly slower than "pre-compiled" version. That is if your "non pre-compiled" site's compilation element in web.config has "batch" attribute set to false, otherwise it'll spend time compiling all the pages right at startup, which can take too long depending on size of your site. compilation Element (ASP.NET Settings Schema)

After /app_code files and, for example, default.aspx get compiled in "not pre-compiled" site though, there will be no difference in actual performance between the two.

IIS reset or an app pool recycle will not show any differences either, since after deploying one and running both, both sites are compiled. IIS Reset/app pool reset will not cause a recompilation of the "not pre-compiled" site, only changing files/redeploying will.

Take a look Understanding ASP.NET Dynamic Compilation, it's important to understand what that does to compare the two.