Do not buy RAM, compress curiousbits.nl · 25 points · 11 comments · HN thread TL...
HN Best 200 @best
Do not buy RAM, compress curiousbits.nl · 25 points · 11 comments · HN thread
TL;DR The author, facing memory exhaustion from AI-assisted parallel work, argues for enabling zram, a Linux feature that compresses RAM contents instead of buying more memory. In a test with Firefox opened to a long list of sites, 5.7 GB of data fit into 1.7 GB of RAM, a ratio of about 1:3.35. The post also notes that Fedora and Pop!_OS enable it by default while Ubuntu does not.
- Memory demand has risen as AI tools and parallel workloads run more tasks at once, and RAM is often expensive and not user-upgradeable.
- Windows, macOS and many Android phones already use memory compression; several Linux distributions do not enable it by default.
- Fedora and Pop!_OS enable zram by default, Amazon Linux only on smaller VMs, and Ubuntu not at all.
- The author says compression costs some CPU time and latency but yields large capacity gains, with ratios up to about 1:4.
- In a test opening dozens of news, video, shopping and productivity sites in Firefox, 5.7 GB of data was held in 1.7 GB of physical RAM (1:3.35).
- The author suggests the approach could have halved cloud spend for their earlier SaaS monolith by avoiding machine upgrades.
Discussion The thread is mostly practical and friendly, with commenters sharing their own zram setups and distribution experiences. A few push back on the post's claim of no downsides, and one asks whether compression helps with local AI inference, where model weights are already compressed. Several people note that macOS and some distributions have done this for years, so the news is more that it is still not default everywhere. The mood is mildly positive and curious rather than heated.
- zram is useful and easy to enable yourself (many): Several commenters say they turned on zram or zswap on their own machines or servers and found it works well, including a 1GB RAM server. One points to systemd's zram-generator as an easy way to set it up.
- Compression is already default on macOS and Fedora (some): Commenters point out that macOS has used memory compression for a long time and that Fedora has enabled zram by default for years. They find it surprising that it is not standard on more Linux distributions.
- Post overstates lack of downsides (a few): Two commenters argue that the stated CPU cost and added latency are downsides, so the claim of none is contradictory. This is a minor but direct criticism of the wording.
- Compression won't help with local AI models (a few): One commenter notes that model weights are already highly compressed, so further RAM compression is unlikely to save much when running local inference. The question is posed without a clear answer in the thread.
- Use zswap when a swap device exists (a few): One commenter recommends zswap over zram when there is a backing swap device, linking two comparison articles. This is a technical correction to the default advice.
Links from the comments