Hacker News new | ask | show | jobs
by LargoLasskhyfv 331 days ago
Hrrm. My comment was supoptimal, I guess.

By "Not even insane amounts of RAM, it usually takes about 4 to 5GB, rarely going to 8, then shrinking back a while after closing too much tabs." I meant to say that this applies to the resident size in RAM of the whole browser, not what PSD does, or adds. That would be just what your browser profile is using 'on disk'. Peanuts, so to speak.

With only 8GB it's really hard to tell. It depends on your usage patterns.

First, regarding just PSD, it relies on RuntimeDirectorySize= of https://man.archlinux.org/man/logind.conf.5 which by default is limited to use up to 10% of system memory, but not statically reserved, only "on demand".

Which in turn relies on tmpfs which can use up to half of system RAM by default. Again, on demand only, not statically reserved.

https://wiki.archlinux.org/title/Tmpfs https://wiki.gentoo.org/wiki/Tmpfs

However, I think these are the wrong knobs to turn :-)

PSD can make use of overlayfs, which saves a little bit of used RAM, and is faster to initially sync, but uses more disk space then. But not that much. Which can be further minimized by the number of kept profile backups, or not using backups at all.

Just keep your profile lean and mean, then there's less stuff to shuffle around. Since your'e using Vivaldi, pointing you to wikipages how to make Firefox use less RAM seems pointless ;)

Maybe (carefully) use something like https://www.bleachbit.org for cleaning up Vivalidis profile.

Which leaves things like

https://en.wikipedia.org/wiki/Zram https://wiki.archlinux.org/title/Zram https://wiki.gentoo.org/wiki/Zram https://www.kernel.org/doc/html/latest/admin-guide/blockdev/...

OR

https://en.wikipedia.org/wiki/Zswap https://wiki.archlinux.org/title/Zswap https://wiki.gentoo.org/wiki/Zswap https://docs.kernel.org/admin-guide/mm/zswap.html

to consider.

While it may seem insane to reserve already limited RAM for just another thing, these are worth it. If configured right. I used them, or their predecessors since olden times, when I've just had a Thinkpad T60p with some Centrino and only 4GB.

That made things better in general. Of course it's no silver bullet for everything, but it made the system less sluggish, and it took longer to slow down because of being 'swapped to death'.

From then on I continued to use stuff like that.

On a system with only 8GB, too. ZRAM in this case, because backing device like zswap was impossible, because the HDD blew. So I booted live from USB(2(Arrgh!)) and ran from RAM.

By means of AntiX, which btw. showed my the ways sysctls regarding swappiness, pressure stall information, and related stuff can totally change the behaviour of a system.

Even if it looks strange/ghettoish at first, which can be remastered away easily anyways, the devs really know how to get the most out of older systems with limited RAM and power, in interesting ways. Should be looked at, even if only for 'inspiration', technically.

For instance making things like Firefox shrink back, after having closed too much tabs. And remaining usable, while doing so.

Anyway. Depending on what you do, 8GB only can go a looong way, if configured/used right.

IMO not using ZRAM/ZSWAP, sysctls for swappiness, PSI, etc. is wrong and wasteful.

PSD is just a little icing on the cake.

1 comments

I am using zram. What would the ideal sysctls be for it for 8 GB (maybe even 16 GB?) RAM?
Depends on your usage patterns. On 8GB I gave it (ZRAM) between 512MB to 768MB RAM, and later on just using whatever values for the relevant sysctls AntiX was using(or their scripts created dynamically during setup/startup) at the time. It isn't just vm.swappiness, there are others, and they changed, or got removed, and replaced by others, over the years. And all of them sort of interwoven, influencing each other via what's happening in vm-subsystem. Can have bad feedback loops if you do it wrong, and be counterproductive. So you have to experiment, and measure with different settings, for what you're running.

Where measure can be anything from htop/atop over https://github.com/cdown/psi-notify , to https://github.com/noiseonwires/memory-pressure and so on.

To understand what these sysctls are about, how they are related to each other, and to ZRAM, I'd recommend reading, or at least skimming https://chrisdown.name/2018/01/02/in-defence-of-swap.html , https://chrisdown.name/2019/07/18/linux-memory-management-at... , https://linuxblog.io/linux-performance-almost-always-add-swa... , https://linuxblog.io/linux-performance-almost-always-add-swa... , https://linuxblog.io/linux-performance-no-swap-space , https://linuxblog.io/running-out-of-ram-linux-add-zram , https://github.com/ValveSoftware/SteamOS/issues/899 , https://lonesysadmin.net/2013/12/22/better-linux-disk-cachin... , https://github.com/CachyOS/CachyOS-Settings/pull/19 , https://github.com/CachyOS/CachyOS-Settings , https://docs.kernel.org/admin-guide/sysctl/vm.html , https://docs.kernel.org/accounting/psi.html , https://facebookmicrosites.github.io/psi/docs/overview , https://unixism.net/2019/08/linux-pressure-stall-information...

even if it seems redundant, OFC skim and discard anything you already know(But I can't know that).

The following not to use them, but for their POVs/concepts regarding the same problem: https://github.com/facebookincubator/oomd , https://github.com/rfjakob/earlyoom , https://github.com/hakavlad/nohang

These, to maybe take inspiration from, to adjust dynamically:

https://www.linuxbash.sh/post/tune-vmswappiness-in-a-script-... , https://github.com/lululoid/LMKD-PSI-Activator (Yes, Android, I know, but still...)

Then there is the whole thing about eBPF, which opens up much more screws to turn dynamically according to demand, according to whichever policies.

https://www.brendangregg.com/ebpf.html / https://deepwiki.com/oracle/bpftune/1-overview

Have fun :)