How do I fix FireFox lagging heavily after 150-200 tabs are opened?

I’m new to Linux/Manjaro(Plasma). When using FireFox it starts lagging after about 150-200 tabs are opened across multiple windows, which is about 10-12g of used RAM out of 32g. I didn’t have this issue with FireFox when using Windows (21g RAM) or MacOS(8g RAM). Is there a way to fix this or do I need to use a different Web Browser or do I need to use a different Manjaro desktop environment? Not being able to have 200+ tabs open is a detriment to my use-case. I mainly use firefox for privacy and addons like ublock, sessions manager, open bookmarks slowly, ect… If any other information is needed I’m more than glad to post it. As of now there have been no error messages, that I’m aware of.

inxi -Fanzy (this command was done after FireFox started to lag. At this point 223 tabs are open across 35 windows)

System:
  Kernel: 6.6.19-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.6-x86_64
    root=UUID=8d08b34a-88e0-4761-82ea-a44bc8345f62 rw quiet splash
    resume=UUID=d3e555bb-45ab-4029-bc76-e6f3c7ee1c27 udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.12 info: frameworks
    v: 5.115.0 wm: kwin_wayland vt: 1 dm: SDDM Distro: Manjaro base: Arch Linux
Machine:
  Type: Desktop Mobo: ASUSTeK model: P8P67 DELUXE v: Rev 1.xx
    serial: <superuser required> uuid: <superuser required>
    UEFI: American Megatrends v: 1503 date: 03/11/2011
CPU:
  Info: model: Intel Core i5-2500K bits: 64 type: MCP arch: Sandy Bridge
    gen: core 2 level: v2 built: 2010-12 process: Intel 32nm family: 6
    model-id: 0x2A (42) stepping: 7 microcode: 0x2F
  Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB
    desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB
    desc: 1x6 MiB
  Speed (MHz): avg: 3699 high: 3700 min/max: 1600/5900 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 3700 2: 3700 3: 3700
    4: 3699 bogomips: 26409
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    disabled
  Type: mds mitigation: Clear CPU buffers; SMT disabled
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: disabled, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GF100 [GeForce GTX 470] driver: nouveau v: kernel non-free:
    series: 390.xx+ status: legacy (EOL~2022-11-22) last: release: 390.157
    kernel: 6.0 xorg: 1.21 arch: Fermi code: GF1xx process: 40/28nm
    built: 2010-2016 pcie: gen: 1 speed: 2.5 GT/s lanes: 8 link-max: lanes: 16
    ports: active: HDMI-A-1 empty: DVI-I-1,DVI-I-2 bus-ID: 01:00.0
    chip-ID: 10de:06cd class-ID: 0300 temp: 52.0 C
  Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.4
    compositor: kwin_wayland driver: X: loaded: modesetting alternate: fbdev,vesa
    dri: nouveau gpu: nouveau display-ID: 0
  Monitor-1: HDMI-A-1 res: 1920x1080 size: N/A modes: N/A
  API: EGL v: 1.5 hw: drv: nvidia nouveau platforms: device: 0 drv: nouveau
    device: 1 drv: swrast gbm: drv: nouveau surfaceless: drv: nouveau wayland:
    drv: nouveau x11: drv: nouveau
  API: OpenGL v: 4.5 compat-v: 4.3 vendor: mesa v: 24.0.2-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: NVC0 device-ID: 10de:06cd
    memory: 1.2 GiB unified: no display-ID: :1.0
  API: Vulkan Message: No Vulkan data available.
Audio:
  Device-1: Intel 6 Series/C200 Series Family High Definition Audio
    vendor: ASUSTeK P8P67 Deluxe driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
    chip-ID: 8086:1c20 class-ID: 0403
  Device-2: NVIDIA GF100 High Definition Audio driver: snd_hda_intel
    v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 8 link-max: lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:0be5 class-ID: 0403
  API: ALSA v: k6.6.19-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 1.0.3 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel 82579V Gigabit Network vendor: ASUSTeK P8P67 Deluxe
    driver: e1000e v: kernel port: f040 bus-ID: 00:19.0 chip-ID: 8086:1503
    class-ID: 0200
  IF: eno1 state: down mac: <filter>
  Device-2: Intel Wi-Fi 6E AX210/AX1675 2x2 [Typhoon Peak] driver: iwlwifi
    v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 02:00.0
    chip-ID: 8086:2725 class-ID: 0280
  IF: wlp2s0 state: up mac: <filter>
  Device-3: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK P8P67 and other motherboards driver: r8169 v: kernel pcie:
    gen: 1 speed: 2.5 GT/s lanes: 1 port: a000 bus-ID: 0f:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp15s0 state: down mac: <filter>
  Info: services: NetworkManager,wpa_supplicant
Bluetooth:
  Device-1: Intel AX210 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-1.5:3 chip-ID: 8087:0032
    class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.3
    lmp-v: 12 status: discoverable: no pairing: no class-ID: 6c0104
Drives:
  Local Storage: total: 5.46 TiB used: 169.24 GiB (3.0%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD10EZEX-08WN4A0
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 7200 serial: <filter> fw-rev: 1A01 scheme: GPT
  ID-2: /dev/sdb maj-min: 8:16 vendor: Western Digital
    model: WD4003FZEX-00Z4SA0 size: 3.64 TiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 7200 serial: <filter>
    fw-rev: 1A01 scheme: GPT
  ID-3: /dev/sdc maj-min: 8:32 vendor: Western Digital
    model: WD10EZEX-08WN4A0 size: 931.51 GiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 7200 serial: <filter>
    fw-rev: 1A01 scheme: GPT
Partition:
  ID-1: / raw-size: 896.76 GiB size: 881.61 GiB (98.31%) used: 13.69 GiB (1.6%)
    fs: ext4 dev: /dev/sda2 maj-min: 8:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 296 KiB (0.1%) fs: vfat dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: partition size: 34.46 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/sda3 maj-min: 8:3
Sensors:
  System Temperatures: cpu: 47.0 C mobo: N/A gpu: nouveau temp: 52.0 C
  Fan Speeds (rpm): N/A gpu: nouveau fan: 0
Info:
  Memory: total: 32 GiB available: 31.33 GiB used: 12.81 GiB (40.9%)
  Processes: 283 Power: uptime: 1h 28m states: freeze,standby,mem,disk
    suspend: deep avail: s2idle,shallow wakeups: 0 hibernate: platform
    avail: shutdown, reboot, suspend, test_resume image: 12.52 GiB
    services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd
    v: 255 default: graphical tool: systemctl
  Packages: pm: pacman pkgs: 1194 libs: 361 tools: pamac,yay pm: flatpak
    pkgs: 0 Compilers: clang: 16.0.6 gcc: 13.2.1 Shell: Zsh v: 5.9 default: Bash
    v: 5.2.26 running-in: konsole inxi: 3.3.33

I was going to make a joke about this guy, but I guess it’s a thing https://www.reddit.com/r/firefox/comments/b57oh0/i_always_finish_with_200_tabs_open_of_things_i/

I couldnt reproduce this recently.
But I havent tried again in the last few months.

…Have you tried clearing things (while keeping the tabs), and ensuring that you dont have browser.tabs.unloadOnLowMemory disabled (this feature puts tabs to sleep) ?

Possibly check if it can be reproduced with a clean profile.

1 Like

It’s likely the multiple windows which is the issue. I have 700+ tabs open (albeit only a dozen or so actually loaded/active) but have fixed it so that only one Firefox instance is allowed. No lags here, 8GB RAM.

I would recommend that you follow @cscs’s advice to unload tabs when memory is low, or that you install an addon which unloads tabs after a set period of time, such as the one I use, Auto Tab Discard:

It should be remembered that Firefox tabs don’t just use memory - they are also writing to and reading from the cache on your hard disk. And with most pages being dynamic instead of static nowadays, that means they don’t just write to the cache when first loaded - they are constantly reading from & writing to the hard disk.

Another addon I use in conjunction with Auto Tab Discard is Load Background Tabs Lazily, which reduces the number of tabs loading at the same time:

The combination works really well - I once had more than 1,200 YouTube tabs open in Firefox (on my old PC, which only had 8GB of RAM & a slow HDD), but as most of them had been automatically unloaded, Firefox did not become sluggish.

1 Like

May I ask how you fixed it that only one Firefox instance is allowed? I’m not entirely sure you are referring to one window of firefox active at a time out of several windows or not. I am using sessions manager to do “Tab lazy loading”, however that doesn’t seem to be reducing the RAM used nor reduce the issue. May I ask how you are going about having only a dozen or so actually loaded/active?

Extra note:
In firefox you may also check about:unloads to see more info and options.

1 Like

… and the solution is obviously either:

Use bookmarks instead of opened tabs? You can save all open tabs into a new folder in the Bookmarks menu. Right-click, Select All Tab, right-click, Bookmark Tabs…

https://www.reddit.com/r/firefox/comments/b57oh0/comment/ejbs8yx/

…or download more RAM. :stuck_out_tongue_winking_eye:

1 Like

I have tried it on a newly installed and updated Manjaro before posting here and sadly ran into the same issue. I did go into the about:config and change that setting to true though. Thanks for that suggestion. I’m currently trying a couple other addons that were suggested in this thread.

Thanks I’m currently checking these addons out, that you suggested, to see how they help with my situation. How is the privacy on the " Load Background Tabs Lazily"? It asks " Grant ‘Access your data for all websites’ permission."

In KDE, I right-clicked the application launcher → Edit Applications → in the KDE Menu Editor selected Internet → Firefox and changed the “Command-Line Arguments” box to contain this:
%u --new-instance
and now it throws up an error message if I or some program tries to open a new instance.

I mean allowing only one Firefox window (with as many tabs as you need).

1 Like

Never had a problem with it. Make sure you read the instructions on the addons page though as you may have to manually change a Firefox preference for it to work.

1 Like

Thank you all for your suggestions and help! However, unfortunately none of these suggestions fixed the issue with FireFox. I did install LibreWolf and tried it and have had none of the lag issues that FireFox had. On top of that it uses much less RAM than what FireFox was using. This is just due to how my current version of FireFox is wrongly loading the last session though. The FireFox I’m using came with the Manjaro Plasma installation, so I will be trying to uninstall and reinstall it to see if that fixes the issue and if not I’ll try to see if there is an AUR release for it or a FireFox Linux download from Mozilla themselves to see if that fixes it. However at this point I am happy with how LibreWolf is running so there is a chance that I might just stay with it since it is just a branch off of FireFox. However, I have heard that it is a little bit behind on security updates since it has to wait for FireFox and then add it to LibreWolf.

Frequently Asked Questions - LibreWolf

LibreWolf is always based on the latest version of Firefox. Updates usually come within three days from each upstream stable release, at times even the same day.

that doesn’t mean the package maintainer will update as quickly however, so best to subscribe to some feed

also see if these prefs help (try to avoid unnecessary add-ons):

browser.sessionstore.restore_tabs_lazily
browser.tabs.min_inactive_duration_before_unload
browser.tabs.unloadOnLowMemory

reading through this thread though, i have to ask, why in the world would someone have that many tabs open?

ADHD + OCD in my case.

1 Like

Same here I suppose … in my case it’s not only down to being able to cross-reference between open tabs without having to find and then load from bookmarks (which for me usually also means a C+P into a new tab), but also opening tabs “to look at later” which then inevitably accumulate.

I do purge, periodically. Honest …

2 Likes

one instance is the default. you can have multiple Windows open with a Single instance… as many as you like actually.

To have Multiple Instances of Firefox you need to use

firefox -ProfileManager -no-remote

To create separate instances (or profiles, as Firefox calls it)

and …

firefox -P <profilename> -no-remote

To open the profile (or instance) of your choice. I personally use multiple Instances (profiles) of Firefoxe exact. Not all at once, but it allows me to different ‘activities’ seperated from other ‘activities’, which is actually more convenient.

The most obvious response is… Because they can

In this instance, however, it seems the OP has found the point at which that argument fails with extreme prejudice. :crazy_face:

2 Likes

Considering that my Firefox Currently has 8 tabs open, 3 of which are pinned tabs and it takes up ±900MB of resources:

$ top -bn 1 | grep firefox
604678 mirdart+  20   0   21.5g 901.5m 318.5m S   0.0   5.7  59:57.79 firefox

That means very quickly and roughly calculated each tab uses 900M / 6 = 150MB. So that would mean, you’s need 150(tabs) * 150 (MiB/tab) = 22500MiB/22GiB Ram for 150 active tabs. That obviously changes when tabs are inactive.

Considering you seem to have enough RAM:

I’d say you have three options:

  1. Adapt your behaviour to start closing tabs when you’re done with 'em so that you don’t end up here;
  2. Turning off the browser’s tabs sleep mode:
    1. Launch Mozilla Firefox
    2. Type about:config in the Address bar and press Enter. The Advanced Preferences tab appears.
    3. Click Accept the Risk and Continue.
    4. Type browser.tabs.unloadOnLowMemory in the Search preference name box.
    5. When the browser.tabs.unloadOnLowMemory setting appears, click Toggle to change the setting to False.
  3. Try increasing the number of processes there can be. See https://superuser.com/questions/1264602/how-to-change-firefoxs-number-of-content-process-limit

Hope this helps!

1 Like

these are from a developer i trust

Limit Active Tabs - Get this Extension for :fox_face: Firefox (en-US)

Import URLs - Get this Extension for :fox_face: Firefox (en-US)

Dont Open Duplicate Tabs - Get this Extension for :fox_face: Firefox (en-US)