ZRAM default for 24.04?

Are there any plans to enable zram by default in the upcoming LTS? I’ve had great experience with it over in Pop!_OS and by running zram-config in Ubuntu. I haven’t been able to find much definitive chatter engaging the subject so thought I’d bring it up. Thanks!

5 Likes

I’d love to know any status on this if there is anything established anywhere. I ran my 32GB machine out of memory by trying out Star Citizen (a public pre-alpha and a known resource hog and system killer) in 22.04 and the whole system stuttered to a standstill in swap after about 30 minutes of gameplay (ouch, SSD). Enabling ZRAM via ‘apt install zram-config’ smoothed out the bottom end and not once were there memory issues again. That is WITHOUT the swap partition at all. It was very impressive. Just being able to forego swap and thus eliminating extra wear on SSDs is worth it.

I imagine that low-end systems with much less RAM would really stand to benefit from it going forward.

1 Like

Ubuntu has used zram by default starting in 2009/10 and following releases on ARM images (where we were targeting systems with 256/512MB and less).

With such devices growing their RAM massively (even a RPi is available with up to 8GB today) this was not really necessary anymore…

On intel this question never came up though and with defaulting to swapfiles nowadays which can dynamically grow as needed, I wonder if it is actually worth the extra maintenance effort it puts on the developers…

BTW this is not a desktop topic at all, it should be moved to the foundations track who are responsible for the plumbing layer.

3 Likes

Thanks for the heads up on the foundations track. I will take the discussion there.

With just 12GB of RAM on my former laptop (one of those weird modules), I never had swap issues or OOM with 22.04, and I really wasn’t concerned about wear since these newer SSDs will outlive any mechanical drive lol.

Not all use scenarios are the same. I have experienced heavy swap with 32GB RAM, and when using ZRAM as opposed to thrashing my SSD I experienced both drastically better performance and reliability. ZRAM isn’t just better for an SSD (where flash cell exhaustion can and does still occur for some users), it’s generally much faster too.

3 Likes

For serious games, I would definitely have a card that has 16GB on tap, PLUS 32GB of system RAM. 64 would be better yet – especially if you do a lot of content creation since video editing (like some games) can really eat up resources quickly. RAM is pretty cheap nowadays – with the exception of DDR5 – but even that will come down in time.

My 8GB laptop that I am writing on now uses Mint 20.3 and it is fine for surfing the web and watching videos etc. It can also handle 10 year old browser games as well lol. It still may swap ever so slightly – but only for suspension.

RAM is cheap for some of us that can afford it where we live (but not for everyone), and I understand your point, but the focal point of this topic centers more around the proposal that ZRAM is a better way of handling swap on the desktop for most people. All systems will swap at some point and in some capacity unless specifically re-configured not to do so, and that isn’t necessarily a bad thing. And yes, SSDs are very reliable in most respects, but they are not 1 - 1 superior in every metric to a mechanical drive. That may seem ridiculous at first glance, but while some hard drives last 20 minutes and others over 20 years, most last a good long time before mechanical failure. Whatever their lifetime is, and although slow, they can generally write all day long over and over without worry that the platters will just refuse to take it anymore. This is the scenario that swapping began in. All flash memory is on a steady march to write exhaustion with every bit written, and they do indeed wear out from it for enough people that in general we care about minimizing writes to flash memory. This is also why things like wear-leveling exist, along with spare memory to ‘stand-in’ for the early bits that wear out first. ZRAM can take this out of the equation for swapping, but it’s not even just that. As fast as SSDs are, they don’t come close to DRAM in speed, and even with a light load of compression and de-compression, ZRAM makes for a mighty-fast swap. My argument is that this is just plain better for a common desktop Ubuntu installation, and is good for all manner of use, including those who can’t quite afford or obtain the kind of hardware they want or may even need.

1 Like

It just sounds like the team dropped it because they didn’t think we needed ZRAM anymore due to increased physical memory and larger SSDs with higher TBW/MTBF (powering servers with fewer failure rates than HDDs past 5 years [backblaze]) and it wasn’t worth the extra maintenance, but for some user cases, it does sound like it should be default.

How much trouble would it be to enable this on 24.04 via default?

1 Like

Do you have a reference for reasons for dropping it? I’m not aware it was ever used yet to be dropped.

I started a topic in the Foundations channel and some feel it should be used. Again, other distros are now using it (Fedora → https://docs.fedoraproject.org/en-US/workstation-docs/disk-config/, Pop!_OS → https://www.reddit.com/r/pop_os/comments/104kbs4/zram_now_enabled_by_default_in_pop/ , https://www.omgubuntu.co.uk/2023/01/pop_os_zram-update , and perhaps some others ) Windows and OSX also employ their own forms of memory compression now as well.

2 Likes

personally the default I advocate for is the swapspace package for dynamic swapfiles and zswap with contemporary kernel modules included for compression and pool management. This puts desktop linux on par with macos and windows in this respect.

And MGLRU enabled, but that last one will surely be the default in upcoming LTS. systemd oomd looks like a failed experiment to me so I’d remove it.

3 Likes