Is there any reason I shouldn't enable zswap on all my machines?
It seems like it has so many benefits and I can't really find anyone saying anything negative about it. Is it too good to be true?
Should zswap be part of my standard install for a linux machine or are there scenarios where it would actually do more harm than good?
I'm finding it hard to believe it's such a useful tool when it's disabled by default in the linux kernel.
About this post
- Posted
- Archived
- Score
- 5 · 100% up
- Kind
- Text
- ID
- 96uo8d
13 comments
But how much ram do you have, and do you ever come close to using swap?
Cause if you don't, as you have a large amount of ram, you'll lose performance when you're at the zswap blocks (due to the compression). If possible I'd just enable it on a per need basis, but that's because I got 32G ram and I rarely come close to using it up.
Zswap will slow down performance (because it is compressed) and will only be beneficial on systems that commonly run out of memory.
From Wikipedia:
And today, you probably wait more on I/O than on CPU for a typical desktop machine.
Is performance always slower? Or is performance only slower once I hit a certain RAM usage?
There's a paper from the IBM people that developed zswap. In their experiments, it always improved performance of swap.
About what "RAM usage level" will cause it to activate, the cache of zswap starts out at zero size. It's only in use when your normal swap starts getting used. If your normal swap is not in use, zswap is also not in use.
You could try to find out what RAM usage causes normal swap to be used. There's a kernel variable named "vm.swappiness" that can change this. I don't know for sure how it works. I remember that with the default "60" setting, I get swap usage after roughly half of RAM is in use. And with a "0" setting, there's no usage until RAM is full.
The latter. But like I said, I wouldn't recommend it unless you run out of memory a lot.