23

I'm developing websites in a Windows 7 machine.

When I've installed Firefox I've found some performance issue specially on connecting to the localhost, googling around I've discovered that it's related to the use of IPv6 by the browser to resolve urls.

Using about: config and setting network.dns.disableIPv6 to true the problem is gone.

Now I've the same issue with Google Chrome, but I can't find a way (if there's a way) to do the same I've done with Firefox.

Any suggestions?

2
  • 8
    Have you tried fixing your systems IPv6 problem? Aug 11, 2010 at 15:15
  • I seen super speed with changing Firefox with the above code, so it is common problem. Speedtest.net shows me same ping and download/upload in Firefox without it, Jul 4, 2013 at 0:29

4 Answers 4

21

From: https://stackoverflow.com/questions/1726585/firefox-and-chrome-slow-on-localhost-known-fix-doesnt-work-on-windows-7

Edit your "hosts" file on your computer to make sure there is an ipv4 style localhost entry there. Go to:

C:\Windows\System32\drivers\etc\hosts

Make sure there is a line that looks like

127.0.0.1       localhost

And make sure the line with the ipv6 style is commented out (with #)

#   ::1             localhost

You'll have to run your editor w/ admin mode to be able to save the changes. I had this problem before and this change fixed it for me. It doesn't disable ipv6 on your computer, it just tells it to use ipv4 for localhost lookups.

5
  • works fine, thanks! until chrome doesn't correctly support the disable of IPv6, I'll hold commented this line.
    – tanathos
    Aug 12, 2010 at 6:58
  • That works fine, the problem is that some other systems on your machine might need that setting in the hosts file, i.e. the Team foundation server in my case. If I comment ::1 in the hosts file, TFS access is slow, and Chrome fast :(
    – Juri
    Nov 11, 2011 at 7:33
  • Does this still work with recent Chrome versions on Windows 7? It does not appear to work on Windows 8. If still works on Win7, then Win8 specific question posted here: superuser.com/questions/568597/…
    – Kaliatech
    Mar 19, 2013 at 21:31
  • This still works on Windows 7 with Chrome 26 - just saved me a ton of time tonight. May 4, 2013 at 5:27
  • -1: Of course this will work too but it leaves ipv6 disabled for other applications, so if only chrome should not use ipv6 this is not an option. As there is a command line switch, hacking the sys internals (for which you need root privileges) is some kind ackward.
    – math
    Jul 1, 2013 at 8:01
8

Start Chrome with the command line flag --disable-ipv6

7
  • uhm... it seems to not work... I'm not sure, but the images on the page still loading very slow, one by one... on firefox, same machine, same website, it's really faster
    – tanathos
    Aug 11, 2010 at 14:33
  • Yeah, I found that suggestion on some places but it seems to only be available in nightly builds or something like that... What about disabling IPv6 system wide? Do the Timeline and Profile tab under the Developer Tools (Ctrl+Shift+I) indicate something else going on? You found this to be an issue on Firefox, but on Chrome it might be unrelated... Chrome's proxy settings are inherited from Internet Explorer, maybe it might help to disable IPv6 over there? Aug 11, 2010 at 14:56
  • But I've tested this even with IE, and with IE is fast as with Firefox, if this was related to Internet Settings IE had to be slow... disable IPv6 at operating system level is my last resource :)
    – tanathos
    Aug 11, 2010 at 15:19
  • 2
    Worked fine for me with 9.0.597.107 Mar 1, 2011 at 17:11
  • Fail on Google Chrome 22.0.1229.56 beta (Ubuntu 12.10-beta1)
    – Yohann
    Sep 18, 2012 at 19:45
3

The --disable-ipv6 flag is no longer working (1149303005), so the way to go is using the policy table (RFC3484) implementation of your OS:

  • Windows: google netsh prefixpolicies.
  • Linux: edit /etc/gai.conf.

Unfortunately, Chrome's method for resolving names (async-dns) is ignoring the OS's IPv4/IPv6 precedence, so:

  • Launching Chrome from the console with the flag --disable-async-dns will do the trick but, obviously, you'll loose that functionality.
  • Hopefully, Google will solve the issue 516305 some day :-)
-1

if you're running linux with Google Chrome or Chromium, you can do the same thing as suggested by Matt.

Edit your /etc/hosts file as root.

I commented out all ipv6 addresses ( any with a colon : ) and I'm getting faster page loads, may be coincidence, but I don't think so.

1
  • 1
    This is the same Matt's answer.
    – Peachy
    Oct 20, 2012 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .