logoalt Hacker News

mzhaase • today at 10:38 AM • 2 replies • view on HN

Zram vs Zswap: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...

> If in doubt, prefer to use zswap. Only use zram if you have a highly specific reason to.

> In terms of architecture:

> zswap sits in front of your disk swap, compresses pages in RAM, and automatically tiers cold data to disk. It integrates directly with the kernel's memory management and distributes pressure gracefully.

> zram is a compressed RAM block device with a hard capacity limit. When you put swap on it and it fills up, there is no automatic eviction, and the kernel has very little leverage to do anything about the situation. The system either OOMs or falls back to lower-priority swap, causing LRU inversion (see below). It only really makes sense for extremely memory-constrained embedded systems, diskless setups, or cases with specific security requirements around keeping private data off persistent storage. Swap on zram is also increasingly unsupported upstream.


Replies

keybored • today at 12:04 PM

I enjoyed that Zram article a lot way back when.

( https://news.ycombinator.com/item?id=47500746 )

It’s long and more satisfying than this In These AI Times wrapper.

speed_spread • today at 11:34 AM

What if I loathe swap? The I/O hit of hitting swap, even with SSD, always mean a severely degraded desktop experience. I often end up closing applications to free up RAM or would just order more RAM back when it didn't involve taking a third mortgage.

I would rather have the system tell me there's not enough memory than try to pretend there's an infinite amount of it and then slow to a crawl without apparent reason. Unix memory allocation is daft. Desktop swap to block never worked, never will.

➕ show 4 replies