this post was submitted on 02 Sep 2023
260 points (99.2% liked)

Linux

48145 readers
1021 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
260
ZRAM is insane (www.kernel.org)
submitted 1 year ago* (last edited 1 year ago) by wolf@lemmy.zip to c/linux@lemmy.ml
 

I got a cheap netbook style laptop for traveling some weeks ago (HP Stream 11" with 4 GB of RAM and a N4120). Didn't expect much more from this hardware than opening a few browser tabs and doing some retro gaming via Steam.

Shared RAM with graphics card means that 3.64 GB of RAM are effectively usable for the OS. This was even too little RAM to open a handful of tabs w/o having tabs being unresponsive for seconds sometimes in a very annoying way. Another thing which made trouble was the Wifi - I guess it went into power saving, was swapped and didn't load fast enough to provide a good experience. (Of course I wasted an hour checking for Wifi drivers/support.)

In short: Even for my low expectations for this laptop it was an underwhelming experience.

First step was to look at my vm.swappiness and set it to 10, which already helped, but still the machine had hiccups and annoying timeouts.

In a last, desperate effort I enabled ZRAM on the laptop... and literally WTF: Saying it is a night and day difference doesn't do the experience justice. Typing this words now on the Stream, which I use exactly the same way as my much more beefy other machines (my next worst computer has 8G of RAM and an Intel Core i3), browsing with 10 open tabs, e-mail client open on another virtual desktop... it is crazy, it makes the Stream fun to use and I use it at home for everything which isn't heavily CPU/IO bound.

What surprised me the most: No hiccups, no timeouts and it even fixed the Wifi issues on this little machine. Didn't expect this would be possible, especially with a N4120 and 3.64 GB of RAM.

In short, my laptop changed from not even reaching my low/realistic expectations to being my favorite technical purchase of the last years, thanks to ZRAM.

Besides making this a ZRAM appreciation post, I really want to spread the word about it. Especially for old hardware and limited RAM situations, IMHO it should be the first thing which comes to mind/is recommended.

Fedora and PopOS use it by default, so it is well tested and should IMHO again, be a default at least for desktop setups.

Give it a try - supposedly it even improved the experience on much more beefy computers for gaming etc.

you are viewing a single comment's thread
view the rest of the comments
[–] Animortis@kbin.social 29 points 1 year ago (3 children)

Anyone know of an eli5 on zram? I don't see why just compressing your RAM would make it run better.

[–] Still@programming.dev 21 points 1 year ago

stops having to swap pages to disk, slightly more overhead on the CPU side but for most systems that will be an order of magnitude faster that swapping to disk

[–] wolf@lemmy.zip 18 points 1 year ago

Let me give it a try:

Imagine you are having breakfast and sitting on your breakfast table. Everything on your table and reachable w/o getting up is what your CPU holds in its register. When you need something from the fridge in your home, this is your RAM. If you need something that is not in your fridge, you have to get dressed, get out of our home, walk to the groceries store which is half an hour away, find what you are looking for, pay for it, walk home for around half an our, switch back to your relaxed clothing and finally you can continue your breakfast. The groceries store is your hard disk/ssd whatever. With compression, imagine you have a big second fridge in the basement (or the house next to yours, you get the idea). Not as good as having stuff on your table or in your fridge, but usually at least an order of magnitude better than having to visit the groceries store.

[–] ReversalHatchery@beehaw.org 16 points 1 year ago

Turns out usually a significant amount of RAM is compressible. I was surprised at it too, and actually still am. But of course it also depends on how you use your system. If you run a media player that caches a lot to RAM, its cache wont be compressible, but they say its efficient for example for memory of web browsers.