Slow page loads and .NET 2.0 JIT compilation

SLWK

Guppy
I've recently discovered that .NET 2.0 applications load incredibly slowly the first time they are run immediately after an application or a configuration change (and also after a server boot).

When I say slow I mean several minutes not several seconds.

The reason for this is that asp.net 2.0's compilation approach does not compile the application in visual studio. An application can be "precompiled" in visual studio, but this will only convert source code into MSIL code. When the application is first run and not yet in memory, the application is "JIT compiled", which converts the MSIL code into native code and also checks code access security. Both the JIT compilation and the security check means there is a lot of processing that needs to be done everytime an application loads, and this translates into incredibly slow initial load times. Once an application is JIT compiled, a page loads within a second or less -- considerably faster than any other platform.

All this was quite different in asp.net 1.0/1.1.

The response from Microsoft has been that hardware is important. The processor needs to be as powerful as possible. And there needs to be as much RAM as possible.

Could jodohost create special servers for asp.net 2.0 applications with super powerful processors and a lot of memory, but with the same prices :) ?
 
Wow, interesting info.... x64 seems to be the way to go here, it is ROCKING in speeds when we test it, but it is 100% manual control as hsphere refuses to work, and psoft simply doesn't care.
 
This is going to continue to be an issue for some sites, including mine.

Most of my sites are in development and testing which means that they are not being accessed very often unless the client or I are testing. What happens is that IIS expires the original application memory load and JIT after a period of inactivity. So, next time I hit the site it takes a minute or more to reload in the application and JIT. If the application was in full production, this would rarely happen (I hope) as the pages would be accessed often and therefore not expire.

That being said, this mostly has to do with hosting our sites on a shared server (reseller or not) as there is a huge pinch on memory and processor. Moving to a dedicated or semi- dedicated server is the answer (although I requested package details and never received them ;))

It does take a little convincing when telling the client that it will load much faster when in production.

There are a couple of other solutions out there. One involves writing a script on your local machine setup up on a scheduled task to hit all of your pages once an hour (you could record this with WAST/HOMER). The other I have heard about is a guy on www.ASP.net that wrote a global.asx base class that will JIT each directory on your site on first page load after the application starts up.

Maybe a few of us resellers need to join forces and lease a semi-dedicated or dedicated server.
 
Our semi-dedicated server is not accepting new users right now, we are working on some other options for customers needing the extra oomph of semi-ded or dedicated solutions and will be coming out very soon.
 
Yes, .NET 2.0 on Jodo is just impossibly slow if you have any sort of programming within the page. I think I'm on Win13 and my app crunches to a halt every few hits. On my home 1.8 Ghz/512MB with IIS the code runs flawless but after uploading live the load time is embarrasing.
I'm not sure what to do now but I would recommend anyone thinking of developing in 2.0 on this host to perhaps think of 1.1 instead.
 
thom67,

There was acutally some major cpu abuse on win13, I have just resolved and tried to email the user 4 times at 2 different addressed, but it could be a bit better now. I would highly recommend using pre-compiled code if possible, as it will load much faster.
 
I will also work on breaking the asp.net 2.0 pool into some subgroups, it may help a bit there.
 
Just one more thing to add :)

I have started the .net 2.0 optimization service, it has not been running in the past becasue it uses 100% cpu(it is a low prioirty service and gives cpu to anything needing it), but I am not sure this service will stay on if it causes issues for other users.

It will indeed help with asp.net 2.0, I just won't let it interfere with other processes at the same time.
 
thom67 said:
Yes, .NET 2.0 on Jodo is just impossibly slow if you have any sort of programming within the page.
Just to clarify... are you saying that this slow-load issue only affects *uncompiled* apps?

That is, if one compiles the app first, so that only the dll is required in the /bin folder, then this issue does not occur?
 
I don't know about that.

My commerce starter kit, community server and two other custom .net 2.0 (one is a GDI+ graphic generator which I consdier rather memory intensive), all runs rather well. I didn't do precompile or anything either. First time it hits, a bit wait, but not obvious enough to see a difference.

What do you have in your page and how big are your pages? Just curious.

also, read this http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx, make suer you turn off your debug="true" as you would unnecessarily eat up more memory and your resulting javascript and images won't be cached. This is espeically true if you use Atlas or other fancy stuffs.
 
Stephen said:
I have started the .net 2.0 optimization service, it has not been running in the past becasue it uses 100% cpu
Is there an optimization service for that? :)
 
had the same problem. The reason is that the application domain times out every 20 mins if there is no activity, the first request after the timeout can force a recompile and reload of cache. Changing some settings in the machine.config file will solve the problem; unfortunately for me my hosting provider would not allow me to make this change. I found this utility to be useful.

http://www.spikesolutions.net/ViewSolution.aspx?ID=c2b7edc0-5de1-4064-a432-05f6eded3b82

Essentially it "Pings" my home page every few mins so the application domain does not time out. The utility can also be configured to ping more than one page so that auxiliary pages are fast too.
 
Back
Top