Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are ASP.NET pages so much slower on localhost than on the production server

Tags:

.net

iis

The title pretty much sums it up, and I'm sure there's a perfectly valid explanation,
but it seems extremly odd that loading pages(after they're compiled) on my local computer seems to take forever, when the same code is blistering fast when "live".

I'm developing on Vista, IIS7, pretty ok hardware; while the server is a single machine, running Windows server 2003 and IIS6 on a Xeon <3 ghz and a gigabit line.

Of course, I understand that the web server is especially tailored for this kind of activity,
but it still seems strange that a machine serving up to 2-300 sessions at a time
(spread unevenly on ~5 .Net 2.0 applications) through a remote network(aka. the internet ;-)
is so much faster at presenting the pages, compared to running the code locally...

Just something that's been on my mind for a while...

UPDATE
Thanks a lot for the answers! Just thought I'd add a few points to the above:

  • Have tried removing all obstacles surrounding my localhost; turned off the firewall and antivirus, stopped pouring milk into my computer case, killed any heavy processes etc.
  • This is not contained to just one project or app; it's something I've noticed and wondered about since I started working as a developer ( ~1 year )
  • Don't think inaccessible resources has any significance; when working locally I usually have all the project's assets(pictures, flash, etc.) locally
  • Can't really see any difference concering cache on or off.

Chose a random page from the project I'm currently working on, reloaded it completly a couple of times; locally I got it in about 4 seconds, compared to ~2 sec from the server. This was using FF and Firebug; using Opera I kind of felt there was a smaller difference but that's just my gut...

So I guess that leaves (as you mentioned) harddrives and the database connection... Just seems weird....

like image 242
Morten Bergfall Avatar asked Nov 25 '08 10:11

Morten Bergfall


2 Answers

If you are using FireFox or Safari and you are on Windows Vista then you should disable IP version 6 since this messes with Vista in combination with WebDev and FireFox/Safari...

In FF type in about:config in the address bar, filter for "IPv6" and set enabled to FALSE!

This is a bug with IPv6 in Windows Vista and is a highly likely candidate for your troubles...

like image 174
Thomas Hansen Avatar answered Oct 04 '22 17:10

Thomas Hansen


There are at least two reasons for this:

  • First, your local server is probably running the pages in debug mode with a debugger attached. This makes everything run slower

  • Second, each time you change your pages code or you restart your server all pages must be recompiled, and that takes some time.

On your production server the pages are compiled once and then the compiled version is served to all users, and you are probably not running in debug mode (I hope!).

like image 31
Rune Grimstad Avatar answered Oct 04 '22 18:10

Rune Grimstad