Well, like I said, the slow response upon the first request is just part
of how ASP.NET works. I see it as the cost of doing business. The JIting
is a small part of that, but only happens once ever (assuming the pages
don't change) whereas the cost of starting the AppDomain ocurrs every time
the app starts.
As far as ngen, the downsides, IMO, outweigh the upsides. It's an extra
step to perform. Once an assembly is ngen'd, the code is very brittle --
if any assembly in the dependency tree is changed, then the entire ngen
tree is invalidated and the JITter kicks back in as normal ignoring the
ngen'd assemblies. This makes updating a single assembly more difficult.
Also, when using ngen, you now have two images of your assembly loaded --
the NGen'd one (with the x86) but you also need to load the original one,
since that's where all the metadata is. Lastly, with the x86 code you're
guarenteed the entire things is loaded, whereas with JITing only the code
you call is actually JIT'd.
NGEN was originally intended to avoid the lag one *might* see with windows
forms apps starting due to the JITing. Too often people assumed it was
JITing that was causing their app to be slow -- they would often overlook
the numerous DB round trips as a possible performance problem.
NGEN in 2.0 does get better, but I'm still not convinced it's worth it for
for server based apps like ASP.NET.
I haven't implemented any particular methodology yet myself but I have
seen many articles and proposed solutions such as a control that
pinged the server to keep the application state refreshed. What aspect
of ngen has proven fallible? What solution(s) have you found
meritorious?
<%= Clinton Gallagher
ngen is a red herring -- Kevin was correct in that the majority of
time is the application starting (not the page compilation).
Maybe ngen [1] huh? There's many articles that can be found
discussing what has been learned about maximizing ASP.NET
performance.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL
http://metromilwaukee.com/
URL
http://clintongallagher.metromilwaukee.com/
[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpt
oo
ls/html/cpgrfnativeimagegeneratorngenexe.asp
Is there any way to make my aspx pages appear faster on the first
hit? When browse to a page I have on my local server, I watch the
server's hard drive light chug away for a good 20-30 seconds before
anything appears in my browser. I would be surprised if I'm not
having some would-be web site visitor move on thinking the site is
dead.
Once the first hit has activated the site, it all responds fairly
quickly...that is until the next time the site has been idle for a
while...