Runs Slow The First Time

  • Thread starter Thread starter Steve Bishop
  • Start date Start date
S

Steve Bishop

I have an application that uses data access that runs slow the first
time. My first page reads data from an ODBC source and the second page
hits a MSDE database. After each page opens the first time, they run
just fine.

What should I do? I have all my code in ASPX pages right now, but I
would like to break it up in some code behind. Also, is this the
advantage in pre-compiling data access classes (like in a dll or is
there an easier way)? Help appreciated. Thanks.
Steve
 
You should pre-compile into DLL's before sending it up to the server. But
you will always have a JIT hit on the first access. After that it will stay
in ram.
 
It could be several things.

My first guess, since its not the first page (I would guess IIS initializing
itself as the problem is that were the case), put its the first time you hit
the datasource, is that the database takes a while to initialize itself.

Here is how you can check. Turn on tracing. Put Trace.Write statements
before and after calls to the database. Look at the trace output to see the
time since last to see if there is a dramatic difference in the time between
the first page request and subsequent. If there is a noticeable difference,
get a beafier database server. If the database contains a huge amount of
data, loading the database initially could take some time.

JIT compilation does take time, but it should not be noticeable. You can
precompile the assembly, but I would look elsewhere for the cause.

--
Eric Marvets
Principal Consultant

the bang project

<shameless self promotion>

Email (e-mail address removed) for Information on Our Architecture and
Mentoring Services

</shameless self promotion>
 
Thanks for all the advice. I noticed this does run faster on a faster
server. Will try pre-compile as well as trace method.

Steve
 
Back
Top