Swap but better it behave mostly like actual ram and fast too, not as fast as actual ram but still way faster than swap I can open 5 browser tabs one of them playing a video while compiling a software I don’t feel my system slow down at all
It’s the opposite actually, in terms of implementation Zram is a hack, but it does have it’s use case when your system load doesn’t far exceed your total RAM, on the other hand swap is tightly integrated into the system and it’s on it’s way to implement “Virtual Swap” which is effectively Zram but not a hack, making it like a hundred times better, see This blogpost for a detailed explanation
From my understanding, it’s the opposite. Zswap is the better one since it has a ZRAM-like compressed section of RAM and disk-backed swap. That’s definitely an oversimplification though.
I agree it’s confusing. I always look it up during setup so I know which one to use.
There is a lengthy thread on Reddit about the technical differences. Apparently Zswap will take advantage of the kernel eviction strategy for swap space. Apparently Zram doesn’t have that. To me that never made sense because, you create a Zram block device and then set that as your storage for swap space. Why would the kernel care, or know, that the swap space is backed by a Zram block device.
I do use Zram for my cloud self hosting machines and my dev machine. On the cloud devices they have 1 or 2 GB of ram and on my dev machine I have 32GB of ram. And in both cases it definitely seems like there is swap eviction. I also set the vm.swappiness to 180. Prior to Zram I would set my machines’ swappiness to 10. Swapping is highly encouraged on my machine.
zram, formerly called compcache, is a Linux kernel module for creating a compressed block device in RAM, i.e. a RAM disk with on-the-fly disk compression. The block device created with zram can then be used for swap or as a general-purpose RAM disk. The two most common uses for zram are for the storage of temporary files (/tmp) and as a swap device.
I have a mini PC that has been barreling through NVMe disks but Alpine Linux’ “usb” install mode just wasn’t great either. So I use a “sys” install mode (traditional) on an NVMe disk but have directories like /var/log, /tmp, etc. on Zstandard compressed zram disks. It’s been pretty fantastic honestly.
What is zram?
Swap but better it behave mostly like actual ram and fast too, not as fast as actual ram but still way faster than swap I can open 5 browser tabs one of them playing a video while compiling a software I don’t feel my system slow down at all
It’s the opposite actually, in terms of implementation Zram is a hack, but it does have it’s use case when your system load doesn’t far exceed your total RAM, on the other hand swap is tightly integrated into the system and it’s on it’s way to implement “Virtual Swap” which is effectively Zram but not a hack, making it like a hundred times better, see This blogpost for a detailed explanation
I always confuse ZRAM and ZSwap. From my understanding ZRAM is the better one and Zswap is kinda outmoded.
It turns into a rabbit hole every time I gotta reference it! Lol
From my understanding, it’s the opposite. Zswap is the better one since it has a ZRAM-like compressed section of RAM and disk-backed swap. That’s definitely an oversimplification though.
I agree it’s confusing. I always look it up during setup so I know which one to use.
There is a lengthy thread on Reddit about the technical differences. Apparently Zswap will take advantage of the kernel eviction strategy for swap space. Apparently Zram doesn’t have that. To me that never made sense because, you create a Zram block device and then set that as your storage for swap space. Why would the kernel care, or know, that the swap space is backed by a Zram block device.
I do use Zram for my cloud self hosting machines and my dev machine. On the cloud devices they have 1 or 2 GB of ram and on my dev machine I have 32GB of ram. And in both cases it definitely seems like there is swap eviction. I also set the vm.swappiness to 180. Prior to Zram I would set my machines’ swappiness to 10. Swapping is highly encouraged on my machine.
Why not just set kernel swappiness to 1 and not do any of that?
It’s a Linux feature to compress some of your memory and then store it in a RAM disk. For systems with limited memory, it makes it go further.
https://en.wikipedia.org/wiki/Zram
I have a mini PC that has been barreling through NVMe disks but Alpine Linux’ “usb” install mode just wasn’t great either. So I use a “sys” install mode (traditional) on an NVMe disk but have directories like
/var/log,/tmp, etc. on Zstandard compressed zram disks. It’s been pretty fantastic honestly.