Slow web requests in Firefox under Linux

For some time now I’ve been wondering why each and every request to websites in Firefox is so slow. Pages opened with few seconds delay. I didn’t have time to check thoroughly what causes web page open requests from Firefox working under Linux taking many seconds to complete. Despite the fact my network connection has rather low round-trip delay times.

This bothered me for some time and became more and more irritating as time went by. I’ve found out that this problem doesn’t apply only to one computer, but others using Linux and Firefox also. Every other program and application worked fine. I’ve observed that the problem is not with the download itself, but rather when name resolve occurs. I’ve tested domain name servers I’ve been using for resolving and they where responding to dig command rapidly. So. It was a little mystery to me.

Today, I’ve decided I’d definitely get rid of the problem. So I’ve launched my favorite diagnostic tool – the great WireShark – and went to see what’s going on. At first I’ve observed that when request goes out from the Firefox to the DNS, it seems that two queries are sent: IN A and IN AAAA. Only one answer comes back (IN A). Then after five seconds, again IN A request is sent and as soon as answer arrives the download instantly kicks in. So I knew it was the issue with unnecessary doubled DNS requests and some timeout within the Firefox.

It turns out that Firefox will try to use IPv6 when it’s available. However when you’re on a network that doesn’t use IPv6, even when your Linux box supports it by default, Firefox will try to request IPv6 addresses for each domain. Somehow DNS servers doesn’t send SERVFAIL for AAAA record on my network, causing Firefox to wait until it timeouts (five second delay) and then repeating IN A record DNS request. I’m not really sure if it’s a bug in FF or not. And honestly I don’t care. There’s however a method that will bring back your FF to speed.

In Firefox URL bar type: “about:config”. When it says something about “it’s dangerous, blah blah blah”, click “I promise I’ll be careful” and then type in within the search bar: “network.dns.disableIPv6”. Select it, right-click and then click “Toggle”. When the value of the option changes to “True”, you’re done. Restart Firefox and your long DNS requests are gone.

About Wolverine

If you are looking for IT consultant, let me know! karol at karoltomala dot REMOVE com Just remove the REMOVE word from the e-mail above!
This entry was posted in Linux, Network and tagged , , , , . Bookmark the permalink.

4 Responses to Slow web requests in Firefox under Linux

  1. floorflux says:

    This has nagged at me for a long time! Never enough to look into it I guess, but enough to make me google it today and try out your solution. It definitely seems faster so far. Thanks!

  2. Wolverine says:

    Thanks for your comment! If you’re using Linux you might also want to check those posts:
    which are related to the topic.

  3. Steve Schwartz says:

    A million thanks. Some pages (e.g. took forever (10 mins). I tried to update firefox, only to discover that the pages were also slow(!) and the most recent firefox version no better. Turning off ipv6 as you described works like magic. I’ve decided not to turn off ipv6 totally in my linux system (as your other blogs suggest) until I need to.

    Thanks again.

  4. Wolverine says:

    Hi Steve. I’m glad I could help you. The problem exists because Linux resolver tries ipv6 at first and it waits until request timeouts. This is described in one of my another posts above. There’s also a solution to include:
    options single-request
    in /etc/resolv.conf and it will most of the time work. Unfortunatelly some versions of Linux resolver don’t understand this option.

    Mind you that even though you’ve disabled ipv6 in Firefox, your other applications (ssh, mail, ftp, bittorrent, etc.) that use Linux resolver still will issue IPV6 AAAA record lookup that will slow them down significantly.

Leave a Reply

Your email address will not be published. Required fields are marked *