views:

1341

answers:

10

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....

+1  A: 

There is no reason that the app shouldn't run fast locally in your described setup-- perhaps you have something else going on.

The first thing to look at would be what you are running on your dev box: Anti-virus or software firewalls can be a killer for these things, and you may want to test with that disabled.

Peter Gibbons
+1  A: 

You can also check if your site is trying to access unavailable content (unavailable urls) from your development machine. I've had this problem a couple of times before.

TT
A: 

Have you considered that it may be because of caching? i.e. pages on the production server are cached, and those on localhost are not cached.

I also agree with terjetyl it is possible that your localhost cannot find a linked file (eg javascript source file), your firewall could be blocking these....

DrG
+3  A: 

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!).

Rune Grimstad
A: 

IF there are things stored on the server that the application needs to access, this will considerably slow things down - yes, I've seen places where there was a production server which hosted the only database system available to the whole company, for both production and development.

Tom
+1  A: 

I'm surprised no-one has mentioned hard disks yet. The hard disk is often a typical bottleneck in a system, and desktop hard disks are often a lot slower than server (SCSI) disks. A desktop workstation could also have more processes running that are all using the disk at the same time, whereas server machines are more optimized to run the critical server processes only. But of course, it all depends on what exactly a machine is doing.

+3  A: 

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...

Thomas Hansen
PS! After reading the rest of the answers here, and also your question again I am DEAD sure about that this is the problem. Especially if you try out e.g. Opera, Chrome or IE and they don't give you the speed penalties...How to fix this in Safari I don't know....
Thomas Hansen
I've had to do this before, it'll give you an insane speed boost. Also, the exact key to set is: network.dns.disableIPv6And you want to set it to TRUE, not false. Too bad I don't have enough reputation to edit :(
Kevin Wiskia
A: 

Small million of things are in the game: faster network; better DB server running for a long time and having all queries already executed before; ... maybe is due to Vista :)

Aleksandar
how can you have a network that's faster than your connection to your machine?
Malfist
A: 

Are you actually running this through IIS7 or is it really running through Visual Studio's ASP.NET Development Server? If the latter, well... that right there is a huge reason. The ASP.NET Development Server is optimized to debug applications, not to run them quickly.

The other half the problem is that you didn't actually tell us the specs to your machine, only that it's "ok hardware," not usually a metric when it comes to computer. Vista does suck up some resources, both with its new display manager (for the Aero Glass desktop) and its tendency to pre-load commonly run applications into RAM.

It also sounds like you might be running the database server from your desktop as well, which sucks down more resources that the server machines won't, since they would most likely have (a) separate databases server(s).

R. Bemrose
+2  A: 

Well...after upgrading my machine ([email protected], 1TB >100mb/s search drive ) I see next to no difference even while having this computer do the works ( MS SQL server, IIS ) compared to the same page hosted at GoDaddy. When asking my inital question I had a somewhat lesser machine and compared it to my firms dedicated servers. So the anwer to the question is basically : They're not. Thanks for all of your answers though!

Morten Bergfall