Do not buy RAM, compress curiousbits.nl · 287 points · 234 comments · HN thread ...

@best30

Do not buy RAM, compress curiousbits.nl · 287 points · 234 comments · HN thread

TL;DR A Dutch developer's blog post argues that enabling zram (compressed RAM used as swap) on Linux can add a lot of effective memory at small CPU cost, and reports a measured 5.7G of data held in 1.7G of RAM (about 1:3.35) after opening a long list of websites in Firefox. The post is short on setup details and points to the Arch Linux wiki for how to enable it. The HN thread (287 points, 234 comments) mostly agrees the feature is useful, but argues over zram versus zswap, whether swapping is acceptable, and whether it helps with local LLM inference.

  • Memory compression is already on by default in macOS and Windows, and enabled by default on some Linux distributions such as Fedora and Pop!_OS but not Ubuntu.
  • The author ran Firefox with dozens of news, video, shopping and social sites open until the system memory was nearly full, then observed demand being placed into the zram swap space.
  • Measured result: 5.7G of data stored in 1.7G of RAM, a compression ratio of about 1:3.35; the post cites ratios up to 1:4 in general.
  • The stated costs are a small increase in CPU usage and some added latency, which the author describes as not really noticeable.
  • The author suggests compression could have halved cloud spend in earlier SaaS work by avoiding machine size upgrades.
  • The post gives no detailed setup steps and ends by linking the Arch Linux wiki.

Discussion The thread wanders from the article into the history of memory compression (SoftRAM 95, Stacker, RAM Doubler, macOS's compressor) and into the technical choice between zram and zswap, with many commenters linking Chris Down's zswap-vs-zram article. Mood is mostly informed and friendly, with some nostalgia and jokes (for example about downloading more RAM), plus skepticism about whether the article's claim that compression has no downsides holds up.

  • Compression is a good default, especially on desktops, and already proven on macOS (many): Several users report that macOS memory compression works well and that zram or zswap made constrained machines usable. One commenter with 16GB Fedora says zram let them avoid buying RAM. Others argue desktop Linux should enable it by default.
  • Prefer zswap over zram, especially when a disk swap exists (many): A large group cites the zswap-vs-zram article and says zswap is the better default because it tiers cold pages to disk and does not hit a hard capacity limit. Others counter that zram is better when the user does not want any disk swap.
  • Swapping to disk is a sign of a problem and wears SSDs (some): Some users dislike swap entirely, preferring a fast OOM killer over slow thrashing and SSD write wear. They argue that an early OOM kill is more honest than a degraded desktop.
  • Compression does not help much for local LLM weights (a few): Commenters note that quantized model weights are already near-incompressible by high-entropy measures, and that decompression speed would be the bottleneck for inference.
  • Latency and CPU cost make it unsuitable for some workloads (some): Real-time audio users and server operators say the added latency and page-fault cost matter, so it should be an opt-in setting rather than universal.
  • Browsers and bloated apps are the real problem (some): Several argue that browsers should suspend background tabs or that websites have become too heavy, rather than relying on compression to hide the cost.

Links from the comments

#linux #memory #zram #zswap #compression #swap