?
Solved

Precompiled ASP.Net 2.0 application is slow to start.

Posted on 2007-07-31
16
Medium Priority
?
872 Views
Last Modified: 2013-11-26
My precompiled ASP.Net 2.0 application is slow to start. The first hit to the site can take 30-60 seconds. There are no initial database calls, just a cookie check. The site loads extremely well for all users after the first hit. I'm using the "Web Deployment Project" to create the assembly and merging all the outputs to a single assembly. The only files that I copy to the server are the aspx files (marker files), config files and the files in the bin directory (*.compiled & *.dll).
0
Comment
Question by:reecyp
  • 7
  • 6
  • 3
16 Comments
 
LVL 37

Expert Comment

by:samtran0331
ID: 19599433
This is a normal thing.
IIS needs that "first hit" to start up the asp.net worker process and check the files exist in the asp.net server cache.
0
 
LVL 14

Expert Comment

by:NBSO_ISS
ID: 19599477
When you deploy your site, always make sure that you do the "first hit" as a test.  This way, your users are less likely to experience the slowdown.
0
 

Author Comment

by:reecyp
ID: 19599498
Your answer contradicts articles I've read on MSDN. I thought the advantage of precompiling the app was to avoid the "initial" slowness of the first hit?  

Example MSDN article:
http://msdn2.microsoft.com/en-us/library/ms229863(VS.80).aspx
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 14

Expert Comment

by:NBSO_ISS
ID: 19599554
There are 2 types of pre-compilation...

http://www.vsj.co.uk/dotnet/display.asp?id=568
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19599679
compilation has nothing to do with this, IIS needs to start a worker process...
reboot your machine, open up Task Manager and you'll see there is no
aspnet_wp.exe running, now launch your app and go back to Task manager, and you'll find a aspnet_wp.exe running.

like launching any application in Windows, it takes time to load up.

precompilation deals with whether or not the code is compiled when a user requests code.  it has nothing to do with what you're asking.
0
 

Author Comment

by:reecyp
ID: 19599759
Let me clear that I'm not trying to totally disagree with the answers. I'm just trying to make sure I have an understanding of what is going on and appreciate the help. That being said....

I opened the task manager and couldn't find the aspnet_web process. However, the server I'm depolying to has about a dozen sites. Is there a seperate aspnet_web process for each site? If not, shouldn't this process already be started because of the other sites?
0
 
LVL 14

Expert Comment

by:NBSO_ISS
ID: 19599764
From above link...

"For web sites that are subject to frequent page updates, updateable deploy precompilation is probably better because updateable precompilation allows you to edit and add new pages. These new pages will be compiled on first hit, though. "

On initial deploy, the site will not experience delay, but on updates, it will.
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19599822
is this IIS 6? do you see w3wp.exe
in task mgr?
0
 

Author Comment

by:reecyp
ID: 19599911
We are using IIS 6 (Windows 2003) and I don't see the w3wp.exe process.
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19600001
in Task Manager, do you have "Show Processes from all users" checkbox checked?
0
 

Author Comment

by:reecyp
ID: 19600065
Yes and I'm logged in as an admin.

I am precompiling the app with MS's web depolyment tool aka Web Deployment Project). Do I still need to run the aspnet_compiler on the server? I'm assuming the answer is no.
0
 

Author Comment

by:reecyp
ID: 19600294
samtran0331 -
It sounds like there will alway be an "initial" delay on just the first hit of a site after a system reboot or initial site setup due to the aspnet_wp process loading and there is no work around. And this is why all the pages accessed after that load as expected. Correct?
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19600338
>>Do I still need to run the aspnet_compiler on the server?
No.

>>Yes and I'm logged in as an admin.
aspnet_wp.exe and w3wp.exe run under system accounts, NETWORK SERVICE or ASPNET depending on version of ASP.Net, so it doesn't matter who you're logged in at.
I'm not sure why you don't see them, but just like MS-Word is required to open a *.doc document, ASP.Net apps in IIS require one of those exe's to run.

This is a nice article on the different processes that happens when running an ASP.Net app:
http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp
Point being that all the stuff the article mentions about the exe's, dll's and processes are *outside* and regardless of the compilation model.

And another thing I mentioned in my first post, is that there is another "initial event" that happens with ASP.Net regardless of compilation model...the server cache.
All ASP.Net apps running in IIS use a temporary cache on the server for the files and dll's associated with the app...for 2.0 it's at:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

If you go to that folder, you should see a folder for each of the apps running in IIS.
If you open one of the app's folders, you might see multiple folders in there too...it maintains the different compiled versions of all the files

0
 

Author Comment

by:reecyp
ID: 19600415
samtran0331 -

One quick question and I'll close this out. Does the server cache get cleared after server reboot, stop/start IIS or when you recycle the application pool?

Thanks again for all the help. You've given me a better understanding of the whole process.
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 2000 total points
ID: 19600467
>>It sounds like there will alway be an "initial" delay on just the first hit of a site after a
>>system reboot or initial site setup due to the aspnet_wp process loading and there is no work
>>around. And this is why all the pages accessed after that load as expected. Correct?

In my experience, yes.
To continue on the server cache explanation...whenever you do a re-boot or initial site setup...and then you load the site...IIS and the processes will check the cache against the virtual directory to make sure that all the versions match up, if they don't, IIS and the processes will create a new folder in the cache directory and place the updated dll's and files in there...this also adds to that "initial delay"

Also, it's not just a server re-boot or initial setup that triggers the "initial startup delay"...restarting IIS will also cause the initial delay...

I wonder, if you created a scheduled task to just ping the default page of the app ...the ping might trigger the processes to start and thus less chance of a real user triggering the startup...
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19600505
>>One quick question and I'll close this out. Does the server cache get cleared after server reboot, stop/start IIS or when you recycle the application pool?

Nope.
When testing, I normally clear out that folder manually before any debug run.
In a production environment, you wouldn't want that folder to clear out...if it clears out...then every time you do that IIS/server restart ...then it has to copy the files into the cache...
since it doesn't clear out...all it has to do is check the versions...so in production...having that cache not clear out...is actually making that "initial delay" a bit faster.

Again, as far as I know, both these factors, the IIS/processes and the server cache...are completely separate from the compilation model
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question