Long loading in Firefox

Hi,

Sometimes I have a problem with Firefox - when I try to open a page, it takes very long to load the page. It happens for both firefox and firefox-esr packages

By comparison, pages in Brave don’t not take a long time to load. I opened both (Firefox and Brave) at the same time and the delays were only in Firefox (Brave loads instantly).

Do you know what may be the issue?

3 Likes

I don’t have any suggestions but chiming in to say I’ve observed the same general issue.

1 Like

I noticed this sometimes with IPv6 was not working well, but I have no guarantee it’s related to your problem.

Anecdotally, I’ve also had IPv6 issues with NixOS before.

I decided to disable IPv6 with this config:

  # Disable IPv6
  networking.enableIPv6 = false;
  boot.kernelParams = ["ipv6.disable=1"];

I found out that config here

It looks like the issue still appears when I open a new Firefox (and there isn’t any other Firefox open). The starting page (duckduckgo.com) is loading long (as before).

However, when Firefox is already open and I open pages in new tabs, the issue doesn’t exist. But maybe I need more time to confirm that

Is it slow to load the first time you visit a website? If so, it’s a DNS problem. Once it’s cached, it’s working.

This would mean you the first resolver in your list isn’t working, and your system is waiting for a timeout to use the secondary resolver, which will resolve. The problem won’t appear immediately after because you have a local DNS cache.

3 Likes

Is it slow to load the first time you visit a website? If so, it’s a DNS problem. Once it’s cached, it’s working.

Sorry, I think I didn’t explain clearly - I meant something like this:

  • No Firefox already opened
  • I open Firefox, and starting page is loading for longer time
  • I open another page, or even the same starting page - everything seems fine (pages are loading fast)
  • I close all Firefox tabs and windows (so there is no Firefox process running)
  • Open the Firefox again, the starting page is loading for longer time

I don’t think it’s a DNS issue, as it seems to only appear when “starting” a fresh Firefox

2 Likes

Now that you mention it, yes, I have this too. It’s quite noticeable if you run multiple Firefox profiles, there seems to be an initial delay for page loads when starting the browser.

Is this actually NixOS specific or does Firefox just take longer to start initially than other browsers? Firefox tends to be open most of the time for me, so I hardly notice when actually using it, and don’t have a non-NixOS system around these days.

I think the default on Firefox on NixOS is to use DNS Over TLS through Cloudflare servers, can you try disabling this?

I think Firefox has an internal DNS cache :roll_eyes:

It’s not enabled on my Firefox (didn’t change that, so I guess that’s the default):

I think Firefox has an internal DNS cache :roll_eyes:

Hm, I found out that (you can open that DNS stuff with: about:networking#dns):

I cleared the cache, and opened duckduckgo.com in a new tab, it loads immediately. So I guess caching shouldn’t be the issue?

On my work machine I use Fedora, I haven’t notice similar issue there. But maybe I haven’t payed attention - I will check it tomorrow

I checked that, and there is the delay on starting Firefox on Fedora as well. So I guess, it’s normal (but strange)

1 Like

To sum up, disabling IPv6 helped with long loading in general. Startup loading is probably a normal Firefox thingy. Thank you all for help! :heart:

1 Like

Hrm, you made me curious, so I gave it a search, looks like we’re not the only ones seeing this: https://libreddit.tiekoetter.com/r/firefox/comments/tsnnpy/firefox_very_slow_to_load_first_page_after/

Disabling ublock origin actually noticeably improved things for me, so it could well be caused by add-ons. Not that I’d use Firefox without it anyway, but nice to know there’s a reason.

2 Likes

Disabling ublock origin actually noticeably improved things for me, so it could well be caused by add-ons. Not that I’d use Firefox without it anyway, but nice to know there’s a reason.

Oh, I disabled ublock, and also noticed much shorter loading. But I’m going still use ublock (the initial loading isn’t worth disabling it)

1 Like