常见算法效能如下:

2024-02-03T15:03:27.png

常用命令

cat /sys/block/zram0/comp_algorithm # 查看支持算法
zramctl # 查看当前 zram
free -h

开机启动

echo "zram" > /etc/modules-load.d/zram.conf
echo "lz4" >> /etc/modules-load.d/zram.conf
echo 'ACTION=="add", KERNEL=="zram0", ATTR{disksize}="16G", ATTR{comp_algorithm}="lz4", RUN="/sbin/mkswap -U clear /dev/%k", TAG+="systemd"' > /etc/udev/rules.d/99-zram.rules
echo "/dev/zram0 none swap defaults,pri=100 0 0" >> /etc/fstab

调优

加入: /etc/sysctl.d/99-vm-zram-parameters.conf

vm.swappiness = 180
vm.watermark_boost_factor = 0
vm.watermark_scale_factor = 125
vm.page-cluster = 0

Ref

Last modification:February 3, 2024
如果觉得我的文章对你有用,请随意赞赏