StrataFrame Forum

ASP.NET 2.0 website with SF optomization

http://forum.strataframe.net/Topic6584.aspx

By Keith Chisarik - 2/6/2007

I just published a SF/SQL website and the first time a visitor goes to the site, the pages are slow to load. My understanding of this is because the HTML is dynamically rendered in ASP.NET and the first time it essentially just takes longer.



Is there any way to speed this up other than throw hardware at it?



The initial pages are not complex but still take 3-10 seconds to load the first time, subsequent visits are much faster but I think this still leaves the wrong initial impression.



Any help or insight will be appreciated.
By Trent L. Taylor - 2/6/2007

Actually the problem is that the website is compiling the first time a visitor is showing up at your site, and thus the slowness.  You need to precompile your website to resolve this issue.  .NET comes with an ASP compiler that will do this for you and can even be added to a post build event, or just added to a batch file.  This is basically the same thing as right-clicking the web site and then clicking publish.  Using the command line option will allow you to add any additional copy commands after the aspnet_compiler and place it in a general location so that you can upload is separately if you need to.  Below is an example of how to pre-compile a site.

aspnet_compiler -p "c:\MyDevWebSite\" -v / "c:\Output\compiled site"

FYI, you can run this through the Visual Studio command prompt or just directly call it.  This file is located "C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe".

By Keith Chisarik - 2/6/2007

I thought I did that, maybe I did it wrong. Attached is a SS of how I published, then I copied the resultant directory to my web server via FTP.



Am I lost?



By Trent L. Taylor - 2/6/2007

No.  It generally this will work.  You might try the manual option.  Now keep in mind that the very first visitor after IIS has been restarted might take just a second to load the site.  However, after this it should always be fast.  You can be the "first visitor" to make sure the site is loaded.  Afterwards though, it should be fast for all other visitors.
By StrataFrame Team - 2/7/2007

Pre-compiling the website is supposed to fix the 1st page load slowdown because the when the page is stale, it has to be recompiled. 

However, if you're still getting very poor responsiveness for the first page request, you can try some other things:

1) Put the website in it's own application pool
2) Place a standard .html file in the site and see if it takes as long as the .aspx pages do

By gbenjamin - 8/9/2007

Another option I find helpful is to disable idle timeouts on the Application Pool in IIS.  Do that under the Performance tab of the Application Pool.  Either uncheck the idle timeout checkbox or set it to a higher value.  I have noticed that over weekends where I work the IIS worker processes will shutdown making our ASP.NET websites slow to load on Monday morning.  By removing the idle timeout we don't have to worry about it.  I would not recommend doing this to the Default pool though so create a new pool, add your site to that pool, and remove the idle timeout.