6 ms·
Use zram instead. This from crappy 8G RAM multimedia/browsing minipc I'm on right now. The SSD is quite slow and browser is memory hungry so it was an improveme
by rini17 25d ago
Use zram instead. This from crappy 8G RAM multimedia/browsing minipc I'm on right now. The SSD is quite slow and browser is memory hungry so it was an improvement from on disk swap.
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 3G 482.9M 86.7M 91.8M 4 [SWAP]
- kees99 25d agozram is a good choice when data in RAM is very repetetive/compressible. Web browsers is one such load. Android apps is another good one. When that data doesn't compress well at all, zram is no help and traditional swap-to-storage is a better choice. And there is a middle-ground option, zswap: swapped out pages will eventually end up on a block device, but are compressed first.
- fpoling 25d agoZram also supports a block device for pages that do not compress. So the primary advantage of zswap is that one can use its swap for hibernation while it does not work with zram.
- MrDrMcCoy 25d agoZram support for a block device is quite misleading, since there are no automatic mechanisms for enabling this. You have to build your own daemon to scan pages and take action on them. Zswap doesn't have that problem.
- fpoling 25d agoOn x64 CPU for laptops the memory bandwidth is rather limited and a fast compressor like lz4 can saturate it. As the result latest SSD are faster then z-ram when using hardware encryption on SSD.
- Rohansi 25d agoIf you care about performance you shouldn't be running from swap period. Swap is just a safety net.
- ssl-3 25d agoIt's OK to care about the performance of the safety net, too.
- fpoling 25d agoSwap is required for hibernation. And with fast ssd or properly tuned zram/zswap one can run task that use 10%-20% more memory than installed RAM. Surely there is a slowdown, but it is not that big especially when SSD can read write more than 5GB/s.
- MrDrMcCoy 25d agoSwap is so much more than a safety net and can increase performance if used correctly. See Chris Down's "In defense of swap" and follow-up that breaks down zram vs zswap.
- marginalia_nu 25d agoSwap actually helps with performance for the most part. Here's a good summary of what it actually does. https://chrisdown.name/2018/01/02/in-defence-of-swap.html https://chrisdown.name/2018/01/02/in-defence-of-swap.html TL;DR that swap shouldn't be seen as "spare RAM", but a mechanism for paging out anonymous pages, which is desirable in many circumstances in avoiding OOM situations and making memory management work better. It paradoxically typically reduces I/O thrashing.
- Rohansi 24d agoIt helps with performance by allowing your system to have more free physical RAM. And by free I mean for caches. It does this by moving data from inactive pages out of physical RAM. You shouldn't care about the peak bandwidth of zram vs. ordinary swap because latency matters more.
- 25d ago
- MrDrMcCoy 25d agoZswap is even better than that. Give it a try sometime.
- lotharcable 24d agoZswap has improved to the point where it is now preferable over Zram. https://linuxblog.io/zswap-better-than-zram/ https://linuxblog.io/zswap-better-than-zram/ There is a few other people documenting the same thing if you look around. As far as Linux and swap goes, very generally speaking: if you don't have a application that specifically advises against having swap you are almost always better off with it. If you don't end up using it then it costs you almost nothing. If you end up using it then it just makes your system more efficient because you are giving up performance for less used memory to make way for more used memory. Zswap sweetens the deal. In the distant past having swap on a desktop was irritating because file system operations from nightly crons would end up pushing your applications into swap. Then when you go to use your desktop in the morning it will grid away at the disk until the memory was loaded back into main. This sort of behavior has been mostly solved for a couple decades now, but somehow the idea that "swap is bad and slow" still persists.
- LelouBil 24d agoOn Bazzite I had to use a swapfile and disable zram to have hibernation working
- tmtvl 24d agoNah, zswap is way better than zram: <https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-...>.
- rini17 24d agozswap is back in kernel? Edit: seems I got confused there, only frontswap layer was removed, and zcache