Do not buy RAM, compress
Enabling RAM compression on Linux, via features like zram or zswap, can significantly extend usable memory and delay or avoid the need to buy more physical RAM, especially on laptops and small servers. Commenters compare Linux approaches with macOS and Windows, which have shipped memory compression by default for years, and debate when compression is beneficial versus when it adds unacceptable CPU and latency overhead (e.g., in real‑time or server workloads). A recurring theme is that compressed swap is powerful but not one-size-fits-all: zswap is often preferred when disk-backed swap is available, while zram shines on diskless or highly constrained systems or when users explicitly want to avoid swapping to SSD.
Overall sentiment on RAM compression
- Many commenters are positive on RAM compression (zram/zswap), reporting being “blown away” by how much more they can do on existing hardware, especially on 8–16 GB machines.
- Others stress it is a time/space tradeoff, not “free RAM”: more CPU use and latency under pressure, and sometimes poor outcomes if misconfigured.
- Several note this is an old idea (RAM doublers, DriveSpace, etc.), now reappearing with better hardware and OS integration.
OS defaults and ecosystem differences
- macOS and modern Windows have memory compression enabled by default; macOS has had it since ~2013 and reportedly compresses inactive pages aggressively.
- Some Linux distros (Fedora, Pop!_OS, Ubuntu with configuration) enable zram by default, but many still do not; several argue it should be on by default for desktops, off or opt‑in for servers and real‑time systems.
- Windows: compression is tied to having a page file enabled; with ample free RAM, compressed usage remains small.
zram vs zswap debate
- One strongly argued position: prefer zswap in most cases, especially when a disk backing store exists; zram swap is called a hard‑limit device that can cause OOM or pathological eviction.
- Counter‑position: for typical end‑user desktops and laptops, zram (often with LZ4) works better, avoids disk swap entirely, and is simpler; zswap is framed as more suitable for servers.
- Some anecdotes:
- Users report zram outperforming zswap on low‑RAM or diskless systems.
- Others advocate zswap + aggressive OOM handling (earlyoom/systemd‑oomd) as the “optimal combo.”
- There is concern about SSD wear when disk swap is hit heavily, and some people intentionally avoid any disk swap.
Workload-specific considerations
- Desktop: major gains when browser/electron apps dominate RAM; extension‑based or built‑in tab suspending is seen as complementary to compression.
- Real‑time / low‑latency audio and safety‑critical systems: several argue compression should be off due to extra and unpredictable latency.
- Local LLMs and model weights: commenters state quantized model files are already near entropy limits and don’t compress well; compression mostly helps with other memory (e.g., browser, background apps), not model weights themselves.
Implementation details and tuning
- Tools mentioned include systemd‑zram‑generator, zswap with configurable algorithms (LZ4 vs Zstd) and swappiness.
- Advanced kernel features (DAMON, CRAM, compressed write‑back to disk) are noted as emerging ways to better manage compressed memory and swap.