开发者

How to figure out why my local host site takes so long to load?

开发者 https://www.devze.com 2023-03-14 11:38 出处:网络
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.

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 sa开发者_StackOverflowme 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.


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.


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!


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.


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)


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.


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.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消