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
Jason Short - 21 May 2004 20:52 GMT
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.
> 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
[quoted text clipped - 6 lines]
> there an easier way)? Help appreciated. Thanks.
> Steve
Eric Marvets - 22 May 2004 03:34 GMT
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.

Signature
Eric Marvets
Principal Consultant
the bang project
<shameless self promotion>
Email sales@bangproject.com for Information on Our Architecture and
Mentoring Services
</shameless self promotion
Steve Bishop - 24 May 2004 16:16 GMT
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