posted on Sunday, December 18, 2005 1:00 PM
by
johnwood
Problem with ASP.Net initial page loading time?
I have a few domains registered that are running asp.net code. I used to wonder why, sometimes, if I haven't used the page for a few hours it would take about 10 seconds to load up the first time. I actually thought this was a problem with ASP.Net -- that it was caching the code or something, and having to recompile if it wasn't accessed for a while.
After doing a bit of investigation, it turns out this isn't ASP's fault at all. Not IIS or even the web host that I'm using.
It turns out it's DNS. Because domain name lookups are cached for a certain amount of time, if nobody using your local domain server has requested the website, the cache will be cleared. This means it has to do a lot more work to resolve the domain name the next time it's requested.
To test this out, I added a link to my website by IP address rather than domain name. Sure enough it was super fast to load, every time, even if I haven't accessed it for a few days. And, even after loading up the page instantly by IP address after a few days, if I then tried to access the page by domain name -- once again it's delayed about 10 seconds before it loads.
What can you do about this? Not much really. It's not really recommended, but assuming you have a static IP associated with your web page, you could encourage people to use the IP rather than the domain name. If you're concerned about browsing time to your favorite sites, you could make make all your shortcuts point to the IP address.
At least this information should save you from cursing ASP for something which is basically a DNS issue.