zRam is a module of the Linux kernel, previously called "compcache". zRam increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive. Since using RAM is faster than using disks, zRam allows Linux to make more use of RAM when swapping/paging is required, especially on older computers with less RAM installed.
Even though the cost of RAM hardware is relatively low this feature still offers advantages for netbooks and other lower-powered laptops, virtualization and in the case of embedded devices, especially those that use flash memories that have a limited lifespan, dependent on write-use and thus wear out quickly when used as a swap device.
Google is going to enable zRAM for Chrome OS by default.
How to enable ZRAM for Debian or Ubuntu ?
Starting with Ubuntu Precise, there is an official upstart script for Ubuntu by Adam Conrad to configure zram in the main repository, just simply type sudo apt-get install zram-config on terminal.
For Debian, you need to download it manually and run it on boot.
- sudo wget https://raw.github.com/gionn/etc/master/init.d/zram -O /etc/init.d/zram
- sudo chmod +x /etc/init.d/zram
- sudo update-rc.d zram defaults
- /etc/init.d/zram start
Check it status on dmsg and free -h
Hint: Using zram is also a good way to reduce disk read/write cycles due to swap on SSDs.