upvote
I never want to swap to disk. If I'm ever in that situation, it means I did something wrong, so I want my userspace OOM killer to trigger and inform me of my mistake immediately instead of wasting time and SSD endurance delaying the inevitable. But zram with lz4 compression is effectively free RAM in most circumstances, so there's little reason not to enable it.
reply
You absolutely do want to swap to disk. There are lots of non-file-backed cold pages that are pointless to keep in RAM forever. You could argue that these pages shouldn't exist, but they do, so why not shove them to a disk?
reply
wasting SSD writes for one. Especially if something leaks and it starts trashing
reply
I want instant access to my rarely used pages just as much as my frequently used pages. It's only pointless to keep in RAM if it's literally never used. If we knew how to identify those pages we could just avoid allocating them in the first place.
reply
Your system is still swapping all your file-backed pages (e.g. .so files) unless you're mlockall()-ing everything. If you pin non-file-backed pages in RAM by running without a swap file, the system has a harder time keeping your frequently-accessed file-backed pages in RAM and can't do as good a job as optimizing your usage patterns.

All you're doing by running without swap is pessimizing yourself.

reply
Good point, dumping to SSD isn't ideal. I think I'm gonna start trying to set memory limits on programs with systemd-run so they can self-limit themselves.
reply
For today's 10,000, do `sudo apt-get install earlyoom` and thank me later
reply
> Especially if you want to swap to disk.

if you don't want to swap to disk you should not use zswap.

zram is ideal in that scenario, though it may complicate OOM killer considerations (you may want a userspace one).

reply
I've tried for running bsdiff and zswap was slower and spilled out data to the disk (which would wear an SSD).
reply