- cross-posted to:
- linux@programming.dev
- cross-posted to:
- linux@programming.dev
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 I’d recommend is setting up a few testing systems with 2-3GB of swap or more, and monitoring what happens over the course of a week or so under varying (memory) load conditions. As long as you haven’t encountered severe memory starvation during that week – in which case the test will not have been very useful – you will probably end up with some number of MB of swap occupied.
And
[… On Linux Kernel > 4.0] having a swap size of a few GB keeps your options open on modern kernels.
And finally
For laptop/desktop users who want to hibernate to swap, this also needs to be taken into account – in this case your swap file should be at least your physical RAM size.
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.




