5 ms·
What I agree is that these days you should still use swap, but swap should always be either on zram or on zswap if you can't use zram for some reason, have too
by zzzcpan 7y ago
What I agree is that these days you should still use swap, but swap should always be either on zram or on zswap if you can't use zram for some reason, have too little ram, can't load zram module or something. Raw swap on disk is just not acceptable anymore for performance, security, wearout reasons.
- gnode 7y ago> performance, security, wearout reasons If memory pressure is low, and the swap is used to page out rarely / never used pages in favour of more disk cache, then there is a performance gain to be had, and wear should be minimal. You can encrypt swap with a randomly generated key to aid security. Ideally memory compression and disk swap would be used together; there's a gain to be had by shrinking lesser used pages, but no sense in taking up any space in RAM for pages showing no sign of life.
- zzzcpan 7y agoMore vfs cache for swap space is not a trade off here, but rather a mostly incorrect oversimplification. The value of more cache is very non linear, it depends on the workload and usually only matters when nearly all of the disk I/O is already exhausted, the exact situation you want to prevent by using more of the same disk I/O for swap. Essentially trading more cache for abrupt performance degradation in terms of latency and responsiveness. I mean, sure, if you can't use zram, say you are on a system that's a bit behind on performance features, like freebsd, very light swappiness might be ok, might free up some of very unused memory and just not be aggressive enough to swap something that causes latency, responsiveness problems, although this is not certain. With memory compression you can swap and compress much more of it more aggressively and be certain that no abrupt performance degradation can happen. It feels like having more ram that's gradually affecting tail latency the more you use it.
- Dylan16807 7y agoZram is nice when you're barely using it, but every time I've seen it get low on memory it degrades quite abruptly, much worse than ssd swap.
- Dylan16807 7y agoThat really depends on what you're doing. In my experience, when Chrome is being a memory hog I can swap about 2/3 of its memory out with zero performance impact. As long as I can swap that away, I never run out of memory. If I can't swap it to disk, I have problems. I don't think that qualifies as "too little ram". So in this case performance is fine, security should be an issue of encryption not disabling, and the SSD is not going to wear out because of an extra <1% average utilization.