MyTetra Share
Делитесь знаниями!
Enable ZSwap to increase performance
Время создания: 10.08.2018 22:07
Текстовые метки: ubuntu zswap perfomance
Раздел: Ubuntu
Запись: Velonski/mytetra-database/master/base/1533920849u6rjtrto6x/text.html на

What is ZSWAP

Zswap is a Linux kernel feature providing a compressed write-back cache for swapped pages. Instead of moving memory pages to a swap device when they are to be swapped out, zswap performs their compression and then stores them into a memory pool dynamically allocated inside system's RAM.

- wikipedia25

You can read more about it in this Beginner friendly introduction182.

ZSWAP has been merged into the 3.11 mainline linux kernel, but is not turned on by default.


ZSWAP will make very efficient use of swap. It will minimizes Disk I/O by both reducing the number of writes and reads required (data is compressed and held in RAM) and by reducing the bandwidth of these I/O operations as the data is in a compressed form. Thus you will not face sudden slowdowns when your system runs out of memory and tries to read/write the swap drive.

For whom it wont work

Who does not have a SWAP partition

People with less than 1ghz CPU speed

People who uses ZRAM

For whom this tweak will work

People who have a dedicated SWAP partition / SWAP file

People with low system memory

Steps to enable ZSWAP

Check if your OS Kernel comes with ZSWAP by running the command below.

If the response is CONFIG_ZSWAP=y, you are OK to proceed.

cat /boot/config-`uname -r` | grep -i zswap

Open grub as admin

gksu pluma /etc/default/grub

Change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.compressor=lz4"

Save, close Pluma. Update Grub by running

sudo update-grub

Enable lz4 (for very fast compression/decompression)

sudo su

echo lz4 >> /etc/initramfs-tools/modules

echo lz4_compress >> /etc/initramfs-tools/modules

update-initramfs -u

Restart your PC.

Check if ZSWAP is enabled by running (Mentioned by @1Q7FE6zp)

cat /sys/module/zswap/parameters/enabled

If ZSWAP is enabled, you should see Y in return.

To check if LZ4 compressor is being used run

dmesg | grep -i zswap

Check the last line of the response. If the result says

[ 0.715381] zswap: loaded using pool lz4/zbud

Then voila ! You've successfully enabled ZSWAP.

MyTetra Share v.0.58
Яндекс индекс цитирования