Startup delay due to compiling

C

Chris Zopers

Hello,

To prevent my webapplication from compiling when a user first visit's
the site, I precompile the application with the aspnet_compiler tool
(aspnet_compiler -p physicalOrRelativePath -v / targetPath).

When the application ends/stops because of inactivity for a while, it
still takes some time when a user tries to access the site again. This
is only on the first visit after the site has stopped, after that
everything works fine and fast. FYI, I do not use any code in the
Application_Start event, so that can't be the problem.

Anyone got an idea, am I doing something wrong perhaps with the compiler
tool?

Greetings,
Chris
 
M

Mark Fitzpatrick

No, you're not doing anything wrong, this is the way it is. You compile the
site into Intermediate Language (IL). When the application starts up, it
compiles it into machine language and caches that and assigns resources.
Part of the delay is just the application starting up again regardless of
anything going on in the Application_Start event.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
C

Chris Zopers

Okey, so not using the compiler tool would mean that on the first visit
the site will be compiled to IL and after that to machine language (two
times compiling) and using the compiler tool would mean that the first
compiliation (into IL) does not have to take place anymore? Am I getting
this right? So using the compiler tool would improve the startup time a
bit by eliminating the compilation into IL?

Greetings,
Chris
 
B

BWC

That's correct.

You can control the delay you're experiencing with the JIT compiler, by
modifying the web.config setting for compilation. Setting batch="false" will
cause each page to be compiled individually as it is first requested - rather
than compiling a number of pages into machine specific binaries.

<compilation batch="false">

You can also configure the batch size, and other details.
http://msdn.microsoft.com/en-us/library/s10awwz0.aspx

Best of luck,
BWC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top