ASP.NET application and first time load

J

Jason

Hi

I have a "problem"
i have got a ASP.NET application. in this application i have included
logging. in the logging i have logged how many seconds it takes for this
application to fully load.
i have placed these timing loggings in the Load and Init events on a typical
aspx page. i.e. first line of code in Page_Load is
DateTime dtStart = DateTime.Now;
and the last lines of code are
DateTime dtEnd = DateTime.Now;
TimeSpan timeTaken = dtStart - dtEnd;
// log result to log files;
according to my log files, for the first load, it takes 2 seconds for the
application to fully load. every subsequent access to that application takes
1 second or less to fully load. yet, when i manually count the seconds
between clicking "Go" and the time the application is fully loaded, it is
about 17 seconds.

NOTE: the above is a first time load (restarting the web server, or
restarting IIS). every load (from "Go" to "finish") after that, takes 2
seconds or less. Restarting IIS service will then mean the application will,
again, take 17 seconds to load, but only 2 of those seconds are used by the
application.

Are their events i am missing that i should be timing?
is it really IIS that is actually taking up all the time?
what can i do about this first time hit?

Thanks.
Hope i have made sense, if not, lemme know so i can clarify
Jason
 
M

MattC

The first time lag you experience is ASP reloading the worker process for
your application. This includes any recompilations needed. This happens
outside the scopr of the application. So there is a delay, then your app
runs and logs its load time.

MattC
 
J

Jason

thanks
any documentation where i can read up on these recompilations?

thanks again
any other suggestions?
 
G

Guest

Hey Jason,

The first time a ASP.NET application runs it has to compile the MSIL code
into Native code for execution and then start responding to request made by
the client (browser).
and any other request made after the first one (the one that starts the
application)
the native code is already present with the framework it need not recompile
the MSIL code to native code.
Hence, anytime you access your application for the first time it is much
slower than any subsequent access.

************************************
Hope this helps,
Shaun
http://blogs.wwwcoder.com/shaunakp
************************************
 
J

Jason

excellent, thanks.
so not much i can do about it?
is there a website i can read regarding this?
 
G

Guest

Hey Jason,

As far as my understanding goes nothing can be done about it , but i fail to
see the problem since this will just happen the very first time the
application is started it wont affect much.

well dont know abt sites, but i am sure this will be documented on MSDN site
, google a bit on this, or have a look at MS Press 70-320

under the section

Chapter 1 : Understanding the .NET Framework -
Lesson 2: Understanding the Common Language
Runtime


******************************
Hope this helps,
Shaun (M.C.P)

http://blogs.wwwcoder.com/shaunakp
******************************
 
J

Jason

Thanks

I also dont see it as a problem. but clients can be a pain in the butt. and
the customer is always right. sigh
Thanks for the help
 
J

Jason

luckily we have a windows service supporting the ASP.NET applications. from
there we can do WebClient.OpenReads to the various pages, effectively
"firing" that compilation.
one more step.

is it possible to determine if the IIS Admin service was just started? are
their events we can subscribe to perhaps??
 
J

Jason

how would i programmatically know that the IIS Admin service was just
started?
i.e. the administrator of that particular web server went and stopped the
IIS Admin service, then started it up again. is there a way of knowing that
the service was just started?

not sure how else i can ask this....
 
G

Guest

Not sure if i understood your qts correctly but
you can build a Windows service inheriting from Service Controll Manager
class or something (not sure about the exact name) using which you can
monitor services running on the machine and inturn fire and event to your
custom service using Custom Commands whenever the IIS service event that you
want to trap is fired.

e.g

the Custom service that you inherit from SCM will monitor IIS Service and
fire a custom command to the service to take some action whenever the IIS
service is shut down or fired up

Let me know if this helps

********************************
Hope this helps,
Shaun (M.C.P)

http://blogs.wwwcoder.com/shaunakp
*********************************
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top