Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Enable ZRAM swap in this image? #41

Open
noobgramming opened this issue Jan 18, 2022 · 3 comments
Open

Feature request: Enable ZRAM swap in this image? #41

noobgramming opened this issue Jan 18, 2022 · 3 comments

Comments

@noobgramming
Copy link

Hello! We run lots of Docker containers using Colima, which AFAIK uses this Alpine image.

Our machines struggle with free ram when running many containers, and its my understanding that ZRAM is zero overhead until kernel needs it to free up ram space.

If ZRAM isn't enabled by default, could we perhaps turn it on?

@jandubois
Copy link
Member

It is my understanding that zram creates a compressed block device in RAM, so you could use it to host e.g. your /tmp directory or a swap partition. It is not clear to me how it would help with running lots of containers; can you please elaborate?

@noobgramming
Copy link
Author

noobgramming commented Jan 18, 2022

Yes, you can use ZRAM to create a compressed in-memory swap file. The advantage is Linux will start to compress RAM in low-memory scenarios, allowing you to run several times more containers on a machine. And compressed ram is only a few times slower than uncompressed RAM.

When system is not low on memory, the ZRAM swap file is empty so it doesn't use any RAM space. So there's really no disadvantage to using ZRAM swap, it only starts working when its needed. We use it to ward off the OOM killer, but it needs to be enabled in Docker VM to be effective for containers on MacOS.

The most frequent use of ZRAM swap is low memory devices like Raspberry Pi and low end Android phones (its enabled on all low-ram Android phones AFAIK). I think it would also help Docker users that run many containers as well, like me :)

If you want to play with it, this script will configure it on your machine
https://github.com/foundObjects/zram-swap

@afbjorklund

This comment was marked as off-topic.

@noobgramming noobgramming changed the title Feature request: Enable ZRAM in this image? Feature request: Enable ZRAM swap in this image? Jan 20, 2022
jandubois pushed a commit to jandubois/alpine-lima that referenced this issue Nov 6, 2024
Bump Alpine 3.20.0 → 3.20.3 and nerctl 1.7.7 → 2.0.0-rc.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants