LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-06-2019, 10:35 AM   #1
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Rep: Reputation: Disabled
firefox swap issue


I have been having a problem with firefox in current for a while which still affects mozilla-firefox-68.2.0esr.

Basically when I have very little ram usage firefox will insist on using the swap instead which proceeds to drag the system to a halt. Sometimes it can swap several GBs while I have most of my ram unused. Is anyone else experiencing this? Any ideas how to solve it short of switching to a different browser? I have tried blocking scripts, avoiding potentially problematic sites which does not seem to be entirely consistent, firefox safe mode, a new firefox profile and nothing helps. I have found many tips on reducing ram usage online, but while they did help reduce ram usage, they did not stop the underlying problem.

I have 8 GB ram where 4 GB is tmpfs, 16 GB swap and 6 GB of zram. Turning off the zram did not help and I do not want to remove my swap because it occasionally actually prevents the system from running out of memory.
 
Old 11-06-2019, 10:53 AM   #2
phenixia2003
Member
 
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 907

Rep: Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800
Hello,

You can try to change the swappiness which is set to 60 by default. The lower the swappiness, the less the swap is used (and vice-versa). Example:

Code:
$ sysctl vm.swappiness=10
--
SeB

Last edited by phenixia2003; 11-06-2019 at 11:07 AM.
 
2 members found this post helpful.
Old 11-06-2019, 02:54 PM   #3
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Original Poster
Rep: Reputation: Disabled
I neglected to mention that I tried various swappiness settings, it was currently at 1 so I changed it back to 10. The default of 60 also didn't help in the past.
 
1 members found this post helpful.
Old 11-06-2019, 04:08 PM   #4
Aeterna
Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, CRUX, FreeBSD, Funtoo, HardenedBSD, OpenIndiana
Posts: 231

Rep: Reputation: Disabled
Quote:
Originally Posted by orbea View Post
I neglected to mention that I tried various swappiness settings, it was currently at 1 so I changed it back to 10. The default of 60 also didn't help in the past.
I don't see this problem either in Slackware or BSDs but I have always had disabled
browser.cache.disk.enable;false
browser.cache.disk_cache_ssl;false
dom.storage.enabled;false <- careful, some web sites may not work e.g. countermail.com)


(also privacy issues).

I don't see firefox-esr taking a lot of memory even with several tabs open, but I really timmed prefs.js which may help with overall ferformance of firefox
 
1 members found this post helpful.
Old 11-06-2019, 05:01 PM   #5
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Original Poster
Rep: Reputation: Disabled
I've already disable the first two and I tried disabling the third now. What privacy issues do you mean? Do you have any details on your trimmed prefs.js?
 
Old 11-06-2019, 05:49 PM   #6
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,275

Rep: Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673
@orbea

You should set the swappiness to 1 if you have enough RAM for your running apps. I'm doing it on the ARM boards to protect the SDCard.
And, I just use /etc/rc.d/rc.S for this:
Code:
/sbin/swapon -a 2> /dev/null
echo 1 > /proc/sys/vm/swappiness
Couldn't find a proper doc (kernel.org) where the values are defined, but only this thread:
https://unix.stackexchange.com/quest...ory-management
Code:
vm.swappiness = 0   # Swap is disabled. In earlier versions, this meant that the kernel would swap only to avoid an out of memory condition, but in later versions this is achieved by setting to 1.
vm.swappiness = 1   # Kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely.
vm.swappiness = 10  # This value is sometimes recommended to improve performance when sufficient memory exists in a system, this value *10* could be considered for the performance being expected. 
vm.swappiness = 60  # The default value.
vm.swappiness = 100 # The kernel will swap aggressively.
And, I'm also "taming" firefox to not store the cache on my HardDrive in about:config, here are the cache related options I modified:
Code:
browser.cache.disk.amount_written;0
browser.cache.disk.capacity;0
browser.cache.disk.enable;false
browser.cache.disk.enable_RAS_TEMP;false
browser.cache.disk.filesystem_reported;1
...
browser.cache.disk.smart_size.enabled;false
browser.cache.disk.smart_size.first_run;false
browser.cache.disk.smart_size.use_old_max;false
browser.cache.disk_cache_ssl;false
browser.cache.frecency_experiment;2
...
browser.cache.memory.enable_RAS_TEMP;true
browser.cache.offline.enable;false
 
1 members found this post helpful.
Old 11-06-2019, 07:00 PM   #7
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Original Poster
Rep: Reputation: Disabled
Thanks, I tried those settings in about:config.

I also do not thinks setting the swappiness alone is enough and it may take time to confirm if this is working. Sometimes it runs for a few days without issue, other times it starts swapping almost as soon as firefox starts.
 
Old 11-06-2019, 07:08 PM   #8
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,275

Rep: Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673
Quote:
Originally Posted by orbea View Post
I also do not thinks setting the swappiness alone is enough and it may take time to confirm if this is working.
I can confirm that setting swappiness on 1 will use the swap (write into it) only when the RAM is exhausted. I've been using this for years.
 
Old 11-06-2019, 08:23 PM   #9
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,541
Blog Entries: 25

Rep: Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504
My laptop has 8 GB RAM, I use Firefox heavily, and swap is almost never touched. I think that there's something more going one here. (My desktop has 16 GB RAM and ditto the swap.)

How many plugins/extensions are you using?

What other programs are active along with Firefox?
 
Old 11-06-2019, 08:39 PM   #10
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by abga View Post
I can confirm that setting swappiness on 1 will use the swap (write into it) only when the RAM is exhausted. I've been using this for years.
I've had it set to 1 for a while before and frequently experienced otherwise, but it appears to be just me.

Quote:
Originally Posted by frankbell View Post
How many plugins/extensions are you using?
I reproduce this with a clean profile and no plugins/extensions, but currently I have AdNauseaum, Cookie Autodelete, Decentraleyes, HTTPS Everywhere, Privacy Badger, tab counter and umatrix.

Quote:
Originally Posted by frankbell View Post
What other programs are active along with Firefox?
I have only reproduced it when firefox is open and it always stops when firefox closes, but the window manager is spectrwm and other programs I have open are compton, urxvtd/urxvtc, spacefm, weechat, rtorrent, claws-mail, emacs/vi and gimp.
 
Old 11-06-2019, 08:45 PM   #11
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,541
Blog Entries: 25

Rep: Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504
Quote:
I reproduce this with a clean profile and no plugins/extensions, but currently I have AdNauseaum, Cookie Autodelete, Decentraleyes, HTTPS Everywhere, Privacy Badger, tab counter and umatrix.
Good troubleshooting.

Have you tried running top or htop and then using Firefox? It's long shot, but maybe it will give you a lead.
 
Old 11-06-2019, 09:02 PM   #12
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,797

Original Poster
Rep: Reputation: Disabled
Yes to htop, I can provide a scrot next time it occurs assuming the above steps did not help. Basically it doesn't show much besides firefox with a lot of processes using a lot of memory, that the ram is mostly unused and the swap is being used significantly more than it should be.
 
Old 11-06-2019, 09:29 PM   #13
thirdm
Member
 
Registered: May 2013
Location: Massachusetts
Distribution: Slackware, OpenBSD
Posts: 154

Rep: Reputation: Disabled
I just set my swappiness to 100. I wonder what "aggressive use of swap" will look like.

You may not be in this category yourself (after all, you describe GiB of swap happening somehow) but I feel like this is another of those threads where people are too obsessed with not using swap. Someone in the usenet version of this place (us doing this on usenet instead of here would prevent one use of firefox, though this site I think doesn't misbehave too badly) recently described why you should have more faith in operating system designers, and described it much better than I could.

Do you have a javascript blocker? Are you someone who wants websites to work as their authors intended? I find running torbrowser at "safe" level (noscript blocking practically everything) performs leaps and bounds better than the next more lax setting (medium I think it was called -- I'm in konqueror now, so can't look it up -- btw. konqueror works on this site and performs better than torbrowser in that medium setting). Medium lets everything https run javascript, which to me is kind of useless. A better medium would be to let same origin javascript run, say. Not everything. Everything is tremendously awful in today's web and https websites might be worse than http ones in terms of how much junk they have.

6 GiB ZRAM + 4 GiB tmpfs? Can you permanently leave off the ZRAM? Seems like you're overcommitting your RAM by 2 GiB in the worst case. What are you using the zram for -- my understanding is that it provides a ramdisk? Do you really need 4GiB of tmpfs? I'm only using around 2 GB on my persistent across reboots non-tmpfs tmp directory which has slackbuild output I'm not quick to clean up. You leave the machine on all the time?

If it were me, to debug, I'd turn off both the zram and the tmpfs. Does it still happen with RAM not committed to either of those purposes?

Last edited by thirdm; 11-06-2019 at 10:02 PM. Reason: reviewed zram again, correct question that made no sense.
 
Old 11-06-2019, 09:33 PM   #14
Aeterna
Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, CRUX, FreeBSD, Funtoo, HardenedBSD, OpenIndiana
Posts: 231

Rep: Reputation: Disabled
Quote:
Originally Posted by abga View Post
@orbea

You should set the swappiness to 1 if you have enough RAM for your running apps. I'm doing it on the ARM boards to protect the SDCard.
And, I just use /etc/rc.d/rc.S for this:
Code:
/sbin/swapon -a 2> /dev/null
echo 1 > /proc/sys/vm/swappiness
Couldn't find a proper doc (kernel.org) where the values are defined, but only this thread:
https://unix.stackexchange.com/quest...ory-management
Code:
vm.swappiness = 0   # Swap is disabled. In earlier versions, this meant that the kernel would swap only to avoid an out of memory condition, but in later versions this is achieved by setting to 1.
vm.swappiness = 1   # Kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely.
vm.swappiness = 10  # This value is sometimes recommended to improve performance when sufficient memory exists in a system, this value *10* could be considered for the performance being expected. 
vm.swappiness = 60  # The default value.
vm.swappiness = 100 # The kernel will swap aggressively.
And, I'm also "taming" firefox to not store the cache on my HardDrive in about:config, here are the cache related options I modified:
Code:
browser.cache.disk.amount_written;0
browser.cache.disk.capacity;0
browser.cache.disk.enable;false
browser.cache.disk.enable_RAS_TEMP;false
browser.cache.disk.filesystem_reported;1
...
browser.cache.disk.smart_size.enabled;false
browser.cache.disk.smart_size.first_run;false
browser.cache.disk.smart_size.use_old_max;false
browser.cache.disk_cache_ssl;false
browser.cache.frecency_experiment;2
...
browser.cache.memory.enable_RAS_TEMP;true
browser.cache.offline.enable;false
untofrunately, swappiness is not going to solve your problems. Here are relevant parameters that you can play with:
vm.dirty_ratio
vm.dirty_background_ratio
vm.vfs_cache_pressure
note:
dirty_background_bytes
dirty_bytes
use either bytes or ratio but not simultaneously

set
vm.min_free_kbytes to reduce delays due to swappiness

you can disable swap completely:
#swapoff -a (as root)

disabling swap completely will not solve your problems though.
I have only uBlock origin, canvasblocker and decentraleyes installed.
I never had Slackware swapping unless compiling stuff overnight.

Seems like some sort of problems with your firefox-esr.
I don't think that this would help, but rename your .mzozilla/firefox/xxx and see what will happen.
 
Old 11-06-2019, 09:38 PM   #15
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,541
Blog Entries: 25

Rep: Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504Reputation: 4504
I just checked. I'm running the same version of Firefox on this here Slackware v. 14.2 computer (16 GB RAM) and swap is untouched.

This is quite strange.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: OpenBSD: I swap Firefox 2 for Firefox 3 (and don't melt silicon in the process) LXer Syndicated Linux News 0 04-17-2009 03:10 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 09:04 AM
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 01:57 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 02:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 08:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration