8

I noticed today and yesterday that running my site on local host is very slow. I highly doubt this is a code issue as when I put it up on my live site it went fast.

For instance

A page on local host debug mode(F5) takes 44 seconds

The same page on my live site takes 2 seconds

The same page on local host but not in debug mode(ctrl + F5) takes 4 seconds

So I am not sure what is up with my debugger but it slows the site to a crawl.

I have visual studios 2010 Ultimate edition.

I thought it was because of some plugin like (resharper, productivity tools and etc). So I uninstalled every single plugin I had.

I tried making a new asp.net mvc 3 project and it loads up fast in debug mode. I also took the exact same code and threw it on another computer that runs VS 2010 Ultimate and it loads up fast.

So I am not sure what to do next to test.

leppie
  • 115,091
  • 17
  • 196
  • 297
chobo2
  • 83,322
  • 195
  • 530
  • 832
  • I'm not familiar with ASP, but with both PHP and MySQL the default configuration is designed to conserve memory can be very slow. It could be doing something the slow way, to conserve memory, but on the live site is configured with a higher memory limit. – Abhi Beckert Jun 19 '11 at 21:10
  • @ Abhi Beckert - My visual studios when I run the debugger jumps my CPU usage to anywhere from 5% to 100% and memory can go up to half a gig. – chobo2 Jun 19 '11 at 21:16
  • Have you checked all project properties? Things like post build events. – Simon Mourier Jul 04 '11 at 05:48
  • Take a look at the "Output" window. This might give you some clue, whether is is related to the environment or your project. – J. Tihon Jul 08 '11 at 12:15

8 Answers8

5

What Browser are you debugging with?

I had similar issues running my site in FireFox 3+ (Win7).

This was resolved by going into about:config if FireFox and setting network.dns.disableIPv6 to true.

Stewart Ritchie
  • 926
  • 7
  • 13
3

You kind of answered your own question.

A page on local host debug mode(F5) takes 44 seconds

Debug mode creates debug info, pdb files in other words. The resulting DLL also contains symbolic links to these debug info symbols. The size of DLL is bigger. In other words, it has to do a lot more and hence the time. Also, code is not optimized for performance.

If your local webserver hasn't started, then it will take additional time to spin that up, load assemblies, perform JIT and show your app.

The same page on local host but not in debug mode(ctrl + F5) takes 4 seconds

This time it was built without debug info, so significantly less overhead. Probably your webserver was started at this point which further reduced the time.

The same page on my live site takes 2 seconds

Finally, your live site most likely will have the release version of code (without debug info). And most likely, the server will have much more horsepower (CPU/RAM/Cache) than your local PC. Hence the speed improvement.

Irrespective of where you deploy, there will always be a lag on the first hit due to JIT compilation. Your live site, after an IISReset will show this lag too (unless you're using IIS7 and have a warm up module).

Hope this helps!

Mrchief
  • 75,126
  • 20
  • 142
  • 189
  • I agree with this. Maybe all he needs to do is build in Release and retest. – VoodooChild Jul 09 '11 at 08:49
  • @Mrchief - Well why is it then if I take it to another computer and debug in local host it goes pretty much as fast as the live site then? – chobo2 Jul 09 '11 at 18:54
  • @chobo2: No two machines are equal (even if you think they are). This sounds like the problem is with your installation/machine or maybe something running on your machine that is slowing it down (antivirus is a prime suspect). I would say take a HiJackThis(http://free.antivirus.com/hijackthis/) log on both machines and try to find what extra processes or activities are happening on your machine. – Mrchief Jul 09 '11 at 21:52
1

I have had a similar issue a few years back.

The problem was that DNS was failing to lookup something and it retried several times before timing out (15 second delay per try IIRC).

Try check for that with Wireshark.

leppie
  • 115,091
  • 17
  • 196
  • 297
0

Just in case anyone else finds this one. I had a similar problem. Very slow to load even basic html pages.

It was AVG Antivirus.

McGaz
  • 1,354
  • 1
  • 13
  • 22
0

My site load time in debug mode went down from 3 minutes to 35 seconds when I set the Debug for "x86" in place of "Any CPU" in Visual Studio 2015. This is done by simply choosing "x86" from the DropDown in the visual studio toolbar.

I hope this helps someone.

0

This is a stab in the dark as a developer I know had similar problem.

We edited the global.asax file in our project and it seemed to clear out some corrupted assemblies. I suggest you try clear out the GAC of compiled dlls for your app (you'll have to google for location)

Paul Sullivan
  • 2,865
  • 2
  • 19
  • 25
0

Not alot to go on here, but if you have a javascript intensive application, and you are debugging using I/E as your default browser, then the IDE does need to load that javascript into the debugger. I might recommend using Firebug's profiling tool or YSlow to see what files are are the culprit.

Also, (and this may or may not be relevant to your problem), I found a similar situation whereby some of our pages never fully load and seem to hangup on the last resource the browser wants to get. However, hitting refresh, the page loads without a hitch. It is sporadic and causes grief when doing selenium web tests. I believe it may be IIS related.

Dan Doyon
  • 6,710
  • 2
  • 31
  • 40
0

Not sure if this might be it but I had a similar problem a while ago when I was making json requests with ajax. It took nearly 500 ms seconds, after the fix it took only 10-20 ms.

http://www.swarmonline.com/2011/01/slow-asp-net-development-server-windows-7/

This did the trick.

Kevin Cloet
  • 2,956
  • 1
  • 19
  • 36