Use ZRAM to speed up Linux without adding RAM

Use ZRAM to speed up Linux without adding RAM — Zdnet.com
Image source: Zdnet.com

With RAM prices surging, a software approach can improve Linux performance without buying more memory. ZRAM provides a compressed swap space kept in RAM and can make systems feel snappier when physical RAM is constrained. ZRAM stores swapped data in memory rather than on disk, so it is faster than traditional swap.

Many distributions enable ZRAM by default, and it can be installed on Debian-based systems with the command sudo apt-get install zram-tools -y. Configuration involves editing /etc/default/zramswap to set ALGO, PERCENT and PRIORITY; common choices in the example are lz4 for speed, 20% of total RAM and a priority of 100.

After editing, restart the ZRAM service and apply any sysctl tweaks to vm.swappiness, vm.vfs_cache_pressure and related settings. To avoid conflicts, disable the default swap by commenting out the swap line in /etc/fstab and running sudo swapoff -a, then reboot.

zram, linux performance, compressed swap, lz4 compression, zram-tools, /etc/default/zramswap, algo percent priority, swapoff -a, vm.swappiness, /etc/fstab

Latest in