Have your hybrid swap and eat it too…
Systemd-swap is a tool that manages how you use zswap or zram. zswap compresses data that applications don’t use and places it into a cache. The kernel then moves the data to the hard disk, and in most cases this speeds up the swap operation.
The systemd-swap utility can be used to create zram instead, which creates a virtual disk in the computer’s memory, to minimise the number of swap operations. Both methods require memory space and so when zswap uses less memory, zram will make use of that memory to stop the swap process from occurring. Essentially, you need to choose one of the two approaches.
To install the tool, go to https://github.com/ Nefelim4ag/systemd-swap and find the git address and download: $git clone https://github.com/Nefelim4ag/ systemd-swap.git Even though systemd-swap is outside of the standard distribution packages, the software is well written. You have the option to install with the make command or create a package file for Arch or Debian. The Debian package works on Ubuntu, too.
As soon as you’ve installed systemd-swap, you can configure it to use your choice of zram or zswap. The package installs the configuration files. In /etc/systemd/swap.conf, set zram_ enabled or zswap_enabled depending on your needs. Use systemd to activate it: $ systemctl start systemd-swap.service