a relic of a time where memory was scarce
sighs in 2026
a relic of a time where memory was scarce
sighs in 2026
TLDR: Swap is useful to minimize memory contention, put it on your fastest drive, and set vm.swappiness to 100 for ssd swap for optimal swap operation, or leave vm.swappiness alone or set it between 1-50 for spinny bois (lower is better for slow rando. reads)
But how much swap should I use?
What do you all think about zram?

I like zram! It has pretty low overhead and usually compresses data quite well (~2/3x). I have it set to the size of my total ram and I can't notice when it starts to kick in.
Some small amount of swap is also nice to have, but it gets rarely used for me, because zram gets used first.
One trick that might be useful is that you can create a normal swap file and enable swap to it in cases where you want more. For example recently I needed to load 64GB of data on a 32GB laptop, so I created a 64GB swap file on the filesystem and used swapon to enable it. (just disable it before hybernation if you use it!)
It just takes a bit longer to run, but if you don't need all the data loaded at once it's much faster than moving the code on a more powerful pc (or fixing it)...
From my experience: it may feel like you have loads of RAM today. But in ~5 years you'll be regretting not having any SWAP
Man I've read that few months ago and had already forgotten most of it. Reminds me of adjusting the SWAP partition of two VMs though.
I have a swap partition the size of my RAM, but I've never seen the system use more than maybe 4% of it. It's more of an insurance policy than something that's actually used on a regular basis.
I read a kubenetes engineering post that seemed to have the some conflicting info and preformance testing to show. Specifically with point number 3
https://kubernetes.io/blog/2025/08/19/tuning-linux-swap-for-kubernetes-a-deep-dive/
The blog above shows that swapiness should be 0 on workloads sensitive to high I/o latency. Whereas the misconceptions says turning off swap to reduce I/o trashing just shifts the problem elsewhere. I dont have the technical knowledge to know who's right in this situation.
all 14 comments