this post was submitted on 25 Jun 2024
21 points (86.2% liked)

Linux

8191 readers
150 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 1 year ago
MODERATORS
21
submitted 5 months ago* (last edited 5 months ago) by nore@sh.itjust.works to c/linux@lemmy.world
 

Hello, I came across zram recently and I'd like to know if I should use it, my laptop only has ~4GB of ram, and for the most part it'll only stutter when I open multiple programs or a game, so would zram be adequate in my case?

Also, would the compressing and decompressing have a significant impact on my cpu?

top 8 comments
sorted by: hot top controversial new old
[–] CosmicGiraffe@lemmy.world 17 points 5 months ago (1 children)

Try it. The worst that happens is that it makes things slower and then you turn it back off.

[–] DasFaultier@sh.itjust.works 6 points 5 months ago

This. I've had nothing but great experiences with zram on resource constrained VMs in an enterprise grade cluster.

[–] ipacialsection@startrek.website 11 points 5 months ago (1 children)

The major tradeoff with zRAM is that programs are much more likely to crash due to running out of memory, but will run faster when memory is running low and freezes are less likely. You can think of it as offloading the pressure that traditional swap puts onto your disk, onto the (much faster) CPU. There will be an impact on CPU usage, but not enough to cause noticeable slowdown; in my experience running Linux, the CPU is almost never the reason something is slow, and is only going to be under significant pressure if you're running a 3D game in software rendering, compiling a large program, or another complex CPU-bound task.

I wouldn't recommend making the switch unless you often encounter system freezes or slowness while running tasks that use a lot of RAM (like web browsing on certain sites, or gaming), but it will improve things in that case.

[–] nore@sh.itjust.works 7 points 5 months ago (2 children)

Thank you for the detailed response!

I'm gonna give it a try in my current session and if it works I'll make it permanent.

One more thing I'd like to ask though is what would be an appropriate size for zram? Considering it grows dynamically 50% would probably be a good amount right?

[–] ipacialsection@startrek.website 4 points 5 months ago (1 children)

Yeah, 50% (ram / 2) seems about right.

[–] nore@sh.itjust.works 2 points 5 months ago

Ok, thank you for the help!

[–] ArenCoco@lemmy.world 2 points 4 months ago

Fedora use 100% ram size. I have tried it on 4 GB system and it's working good

[–] HarriPotero@lemmy.world 4 points 5 months ago

zram is only suitable if you have no swap. I'd you have swap, zswap does a better job. It also compresses pages in memory, but swaps the least recently used pages to disk when pressured.