by antongribok · 9mo ago · 0 comments
ZRAM is a compressed block device that is stored in RAM. It's great!
Previously, if I ever had high memory pressure situations, I really dreaded the slowdowns. Now, with swap sitting on top of /dev/zram0 it's a completely different experience.
I have ZRAM enabled on all of my personal machines, both laptops with limited memory, and desktops with 64 or 128GB of RAM. It's rarely used, but it is nice to have that extra room sometimes.
The performance of a zram device is so much faster than even the latest NVMe drives.
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 3.8G 2.3G 13.2M 17.2M 4 [SWAP]
2.3GB of 'a's that gets compressed down to 20MB.(It's fun to note that I try to type out "virtual memory" in this thread, because I don't want people to think I talk about virtual machines.)