zswap?


Recommended Posts

I recently read about zswap and thought that it could work well on unraid and make swapping much faster on systems with high ram usage and many vms.

I tried to enable this feature in the syslinux.cfg but there were no signs of it working in syslog.

Also /sys/module/zswap seems to be nonexistent so that i think the unraid kernel is compiled without it.

 

Can I somehow install it or compile a custom kernel with it?

Does this feature even make sense on unraid?

 

Maybe this would work perfectly well. Any ideas?

Link to comment
  • 3 years later...

The beautiful thing about zswap is that is can compress unused portions


swap capability should ALWAYS be used for a linux type system...even if it is a compressed virtual version of itself

https://www.kernel.org/doc/html/v4.18/vm/zswap.html

https://haydenjames.io/linux-performance-almost-always-add-swap-space/

I really think it should be a thing that UnRAID utilizes, or at the very least give us the option to use it

https://www.linuxquestions.org/questions/slackware-14/requests-for-current-14-2-15-0-a-4175620463/page140.html#post5902241

 

Odd thing is...zramctl is included in the latest version of UnRAID (as of this posting Version: 6.8.3)

root@MOBIUS:/mnt/cache# zramctl --help

Usage:
 zramctl [options] <device>
 zramctl -r <device> [...]
 zramctl [options] -f | <device> -s <size>

Set up and control zram devices.

Options:
 -a, --algorithm lzo|lz4|lz4hc|deflate|842   compression algorithm to use
 -b, --bytes               print sizes in bytes rather than in human readable format
 -f, --find                find a free device
 -n, --noheadings          don't print headings
 -o, --output <list>       columns to use for status output
     --output-all          output all columns
     --raw                 use raw status output format
 -r, --reset               reset all specified devices
 -s, --size <size>         device size
 -t, --streams <number>    number of compression streams

 -h, --help                display this help
 -V, --version             display version

Available output columns:
        NAME  zram device name
    DISKSIZE  limit on the uncompressed amount of data
        DATA  uncompressed size of stored data
       COMPR  compressed size of stored data
   ALGORITHM  the selected compression algorithm
     STREAMS  number of concurrent compress operations
  ZERO-PAGES  empty pages with no allocated memory
       TOTAL  all memory including allocator fragmentation and metadata overhead
   MEM-LIMIT  memory limit used to store compressed data
    MEM-USED  memory zram have been consumed to store compressed data
    MIGRATED  number of objects migrated by compaction
  MOUNTPOINT  where the device is mounted

For more details see zramctl(8).

But the actual binary of zram is not included (possibly stripped out by the developers?)

root@MOBIUS:/mnt/cache# modprobe zram num_devices=4
modprobe: FATAL: Module zram not found in directory /lib/modules/4.19.107-Unraid

 

Edited by WarHawk8080
Link to comment
  • 1 year later...

I'm interested in ZRAM support in Unraid too.
I can't create a traditional swapfile because the cache pool (/mnt/cache) is backed by a btrfs RAID1 filesystem and that isn't supported.

 

root@unraid# modprobe zram
modprobe: FATAL: Module zram not found in directory /lib/modules/5.15.43-Unraid


but zramctl is installed...

root@unraid# zramctl -V
zramctl from util-linux 2.37.4


 

Link to comment
  • 3 months later...
40 minutes ago, ich777 said:

It is, can you try to use lz4 instead of zstd for testing purposes?

 

EDIT: All compressions should work except for zstd, is it in your case needed?

lz4 works fine.

# zramctl --find --size 8GiB -a lz4
/dev/zram0

But zstd emerges everywhere. Even zramctl --help mentions it

 <alg> specify algorithm, supported are:
   lzo, lz4, lz4hc, deflate, 842 and zstd
Link to comment
2 minutes ago, bjmi said:

But zstd emerges everywhere. Even zramctl --help mentions it

Only because the help section mentions it, it doesn't mean that it is also supported by the Kernel. ;)

 

Also don't forget that zramctl was included in Unraid but the module was missing, this was simply caused because zramctl is part of the util-linux package for Slackware and because Unraid strictly speaking doesn't use swap the module wasn't included

 

Is this compression algorithm needed or is this your preferred one? Just asking to determine if it is really needed.

A little more for you to read over here: Click and also over here: Click

 

From my opinion lz4 should be the sweet spot in terms of speed and compression.

Link to comment
22 hours ago, ich777 said:

Is this compression algorithm needed or is this your preferred one?

zstd is my preferred one. I can't prove which algorithm would fit best as it is highly dependent of the usage scenario.

 

22 hours ago, ich777 said:

From my opinion lz4 should be the sweet spot in terms of speed and compression.

As zstd isn't available out of the box, one can't make measurements easily.

 

I'm fine with lz4 for the moment as everything else work as expected and Yann Collet is the author of the both algs ;)

Thanks for your effort.

  • Like 1
Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.