Eduardo Molteni
Eduardo Molteni

Reputation: 39453

Asp.net website first start is very slow

The first time I load the website in the production web server, it start very slow, subsequent pages load very quickly (included the home page).

I precompiled the site, but nothing changes.

I don't have any code at Application start. I don't have cached items.

Any ideas? How can I find out what is happening?

Upvotes: 13

Views: 13954

Answers (11)

Robert
Robert

Reputation: 71

Make sure you publish your application in 'release' and not 'debug'. I've noticed this decreases loading time considerably. The web.config file will be updated.

Upvotes: 1

ashish jaiman
ashish jaiman

Reputation: 389

use http://www.iis.net/expand/ApplicationWarmUp for warming up your app this is for IIS 7.5 - so if you are running on Server R2 then it will work.

Upvotes: 1

dfhdfh
dfhdfh

Reputation:

Try clearing your event log?

Upvotes: 1

Mickey
Mickey

Reputation: 664

@Mickey: No, it is turned off. Do I need to turn it on to find out?

The trace log will show you how long each action takes. It could help you find what is taking so long.

Here is a link that might help you get it setup.

Upvotes: 0

FlySwat
FlySwat

Reputation: 175723

The initial slowness is a couple things:

  • The appDomain is being setup
  • ASP.NET is parsing and compiling the ASPX pages.
  • Global Contexts are being initialized.

This is normal behavior for ASP.NET.

Upvotes: 0

icelava
icelava

Reputation: 9857

When you say "precompile" the site, are you using the aspnet_compiler utility to precompile, or simply using the "Build site" option in Visual Studio?

If you are not carrying out the former, I recommend giving it a spin. Coupled with Web Deployment Projects, you should have an easier time deploying your site for each release.

Upvotes: 0

Dillie-O
Dillie-O

Reputation: 29745

Just a quick nod at Darren. That's typical behavior of a .NET app after a DLL update is made. After the initial load everything should zip along just fine.

Upvotes: 0

Darren Kopp
Darren Kopp

Reputation: 77657

It's just your app domain loading up and loading any binaries into memory. Also, it's initializing static variables, so if you have a static variable that loads up a lot of data from the db, it might take a bit.

Upvotes: 12

Mickey
Mickey

Reputation: 664

Have you turned on tracing in your web.config?

Upvotes: 1

ila
ila

Reputation: 4724

When you published the site, did you choose to make the website "updatable" in the publish website's settings or not? If I remember well, the aspx / ascx file need to be compiled as well, and if they are "updatable" then the first start will cause a recompile of those resources.

Upvotes: 2

TheSmurf
TheSmurf

Reputation: 15578

This sounds very much like background compiling; though if you're precompiling, that shouldn't be an issue.

First thing I would look at is your ORM (if any). NHibernate, in particular, has a serious startup penalty, as it runs multiple compilers in the background at startup to turn each class in your data layer into its own in-memory assembly.

Upvotes: 0

Related Questions