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

Shouldn't we set overcommit_memory=1? #19

Closed
gastonmorixe opened this issue Jan 30, 2015 · 14 comments
Closed

Shouldn't we set overcommit_memory=1? #19

gastonmorixe opened this issue Jan 30, 2015 · 14 comments

Comments

@gastonmorixe
Copy link

Guys,

There are some official recommended settings here http://redis.io/topics/admin

One should be
RUN sysctl vm.overcommit_memory=1

What do you think?

Thanks

@yosifkit
Copy link
Contributor

This was discussed in #14. But I am open to good reasons.

@tianon
Copy link
Contributor

tianon commented Jan 30, 2015

It wouldn't be possible to set this via a RUN line in the Dockerfile -- that won't carry into the image.

Also, I think this sets it system-wide, not just for the container, so I'd be wary of setting this in the entrypoint too (which would be the only place it could possibly even work).

@gastonmorixe
Copy link
Author

so, is this a limitation of linux containers?

@Starefossen
Copy link

+1 for RUN sysctl vm.overcommit_memory=1

@archr
Copy link

archr commented Apr 22, 2015

+1 RUN sysctl vm.overcommit_memory=1

@tianon
Copy link
Contributor

tianon commented Apr 24, 2015

so, is this a limitation of linux containers?

Yes. Some sysctl options are scoped to the container, but a large number are read from the host. On top of that, actually changing their values requires write access to /proc/sys, which is impossible by default since /proc is read-only inside Docker. I'm +1 for documenting that folks using this image ought to set this value on their host, but we can't do anything about it inside the container.

@sebicas
Copy link

sebicas commented Oct 27, 2015

Maybe related: boot2docker/boot2docker#1083

@tianon
Copy link
Contributor

tianon commented Dec 24, 2015

See also moby/moby#4717 -- there isn't anything we can do from the Docker perspective except document how to set this value on the host (which would go into https://github.com/docker-library/docs/blob/master/redis/content.md; a PR would be awesome).

@pataquets
Copy link

moby/moby#19265 just merged. Can this solve the issue?

@tianon
Copy link
Contributor

tianon commented Apr 13, 2016

Very cool -- that won't make it into 1.11 (being released today), but we could document for users of 1.12+ how they can use --sysctl on their docker run invocations in order to accomplish this. 👍

@justincormack
Copy link

I don't think vm.overcommit_memory is a namespaced sysctl, so that will not resolve this issue - it still has to be set globally on the host.

@tianon
Copy link
Contributor

tianon commented Apr 18, 2016

@justincormack aww, fair enough -- I suppose that means there's not really much we can do here besides documenting that it's recommended and that it'd have to happen on the Docker host, not in the container 😞

@bkuhl
Copy link

bkuhl commented Feb 21, 2018

This isn't a "run a container to solve a problem" kind of thing, but I appreciate there being containers running as part of a stack to help serve as documentation for what's been done to the host. That said, I believe some folks may find https://github.com/bkuhl/redis-overcommit-on-host useful.

@yosifkit
Copy link
Contributor

Thanks for the note @bkuhl.

Closing since this not something that can be changed by the image, especially since we don't want to have users running the redis container with --priviledged.

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

9 participants