Skip to content

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.

5 points13 comments
Open on Reddit
About this post
Posted
Archived
Score
5 · 100% up
Kind
Text
ID
96uo8d

Author

36
posts
153
comments
1
media
View profile

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.

1 points

Zswap will slow down performance (because it is compressed) and will only be beneficial on systems that commonly run out of memory.

-5 points

From Wikipedia:

On systems with slower hard drives, disk compression could actually increase system performance. This was accomplished two ways:

Once compressed, there was less data to be stored.

Disk accesses would often be batched together for efficiency.

If the system had to frequently wait for hard drive access to complete (I/O bound) converting the hard drive to compressed drives could speed up the system significantly. Compression and decompression of the data will increase the CPU utilization. If the system was already CPU bound, disk compression will decrease overall performance.

And today, you probably wait more on I/O than on CPU for a typical desktop machine.

4 points

Is performance always slower? Or is performance only slower once I hit a certain RAM usage?

1 points

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.

3 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.