this post was submitted on 05 Jul 2024
59 points (96.8% liked)
Linux
5212 readers
66 users here now
A community for everything relating to the linux operating system
Also check out [email protected]
Original icon base courtesy of [email protected] and The GIMP
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
That article is an excellent resource, BTW, thank you. However, it nowhere says anything about swapping being used when you have more memory than you use.
1TB of memory is not a lot, for many applications, so just saying "this guy has 1TB memory and look what he thinks of swap" doesn't mean much. If he's processing LLMs or really any non-trivial DB (read: any business DB), then that memory is being used.
Having space in memory so that you never have to swap is always better than needing to swap, and nothing in Chris' article says anything counter to that. What he mainly argues is that swap is better than OOM killers, having configurations that lead to memory contention in the first place, or seeking alternative strategies to turning off swap.
The fact is, I could turn on swap, but it would never get used because I'm not doing anything that requires heavy memory use. Even running KDE and several Java and Electron apps, I wouldn't run out of physical memory. I'll run into CPU constraints long before I run into memory contention issues.
Frankly, if my system allowed me to have, say, 40GB instead of 64, I'd have done that. I only want to not have to use swap - because never using swap is always preferable to needing it - and slightly more than 32GB is where I happen to land. But I can only have symmetric memory modules, and all memory comes in powers-of-2 sizes, and 64GB is affordable.
Again, Chris' essay says only that swap is better than many alternatives people seek; not that swap is better than being able to not exhaust physical RAM.
As a final point, the other type of swapping is between types of physical memory - between L1 and L2, and between cache and main memory. That's not what Chris is talking about, nor what the swappiness tuning the OP article is discussing. Those are the swapping between memory and persistent storage.