-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Add PIDs cgroup support to Docker #18697
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
Conversation
|
I'd like to point out to reviewers that the tests passing doesn't actually indicate if the code works, since the QA test beds don't support the PIDs cgroup. Please try the tests on your own machine (with a 4.3+ kernel with |
02eddd9 to
d123813
Compare
docs/reference/commandline/create.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of 0 for pids limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is 0 and -1 the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 means "explicitly set the limit to be unlimited, and error out if the cgroup doesn't exist"
0 means "use the default" which results in it being unlimited.
We're trying to iron out this interface in opencontainers/runtime-spec#233.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also thinking it would be nice if there was a sane default for all containers set by the daemon something like 512 (more than enough, but not unlimited)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyphar agreed,
@diogomonica I ran several programs and tested various containers and I think 512 is a good number... it will be applied to the cgroup parent which means not every container gets 512, they get a portion, java uses quite a lot so we are trying to provide security while not having people just change it to unlimited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been running this patch on several of our servers including prod ones to collect stats I'd be willing to show you the results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Would love to see the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill save you the time, they say 512 is the magic number :P
I can make a gist later it's pretty interesting even redis spawns multiple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! Problem solved.
|
Looks like the libcontainer vendor is out of date. |
|
ya its waiting on a pr ;) |
baa7675 to
cdc722f
Compare
|
now rebased on #18788, made it a diff PR, so we dont hold up w this PR design discussion since gccgo needs it |
|
Looks like there were some issues in RunC opencontainers/runc#58 (comment) and the PR was temporarily reverted until those are solved opencontainers/runc#445 |
|
:tear: On Dec 19, 2015, 10:54 -0800, Sebastiaan van Stijnnotifications@github.com, wrote:
|
ed9904f to
3c9890e
Compare
|
we are greeennnnnn |
3c9890e to
33a9207
Compare
|
I think this is now blocked on opencontainers/runc#446? |
|
@thaJeztah Yup, that is correct. |
a02c26d to
a5a1503
Compare
|
Yay! 🎉 |
| NetworkTx float64 | ||
| BlockRead float64 | ||
| BlockWrite float64 | ||
| PidsCurrent uint64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this being set? I think we need something like this: 103cc23#diff-234033fe3b8730c35e53ce0d8dbda485R119
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find that same function on master the stats one in daemon?
On Tuesday, March 8, 2016, Tõnis Tiigi notifications@github.com wrote:
In api/client/stats_helpers.go
#18697 (comment):@@ -24,6 +24,7 @@ type containerStats struct {
NetworkTx float64
BlockRead float64
BlockWrite float64
- PidsCurrent uint64
Where is this being set? I think we need something like this: 103cc23
#diff-234033fe3b8730c35e53ce0d8dbda485R119
103cc23#diff-234033fe3b8730c35e53ce0d8dbda485R119—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/18697/files#r55461314.
Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only meant that setting of this value before pritning seems to be missing on the client side. My commit is based on the containerd branch so the daemon side is different there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something got lost in a rebase because I have used it and it works
On Tuesday, March 8, 2016, Tõnis Tiigi notifications@github.com wrote:
In api/client/stats_helpers.go
#18697 (comment):@@ -24,6 +24,7 @@ type containerStats struct {
NetworkTx float64
BlockRead float64
BlockWrite float64
- PidsCurrent uint64
I only meant that setting of this value before pritning seems to be
missing on the client side. My commit is based on the containerd branch so
the daemon side is different there.—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/18697/files#r55464136.
Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's right here :)
https://github.com/docker/docker/pull/18697/files#diff-77f23598eb03c37b3f275940922fe494R65
On Tuesday, March 8, 2016, Jessica Frazelle me@jessfraz.com wrote:
Maybe something got lost in a rebase because I have used it and it works
On Tuesday, March 8, 2016, Tõnis Tiigi <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:In api/client/stats_helpers.go
#18697 (comment):@@ -24,6 +24,7 @@ type containerStats struct {
NetworkTx float64
BlockRead float64
BlockWrite float64
- PidsCurrent uint64
I only meant that setting of this value before pritning seems to be
missing on the client side. My commit is based on the containerd branch so
the daemon side is different there.—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/18697/files#r55464136.Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu
http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see yeah that was definitely lost in a rebase :(
On Tuesday, March 8, 2016, Tõnis Tiigi notifications@github.com wrote:
In api/client/stats_helpers.go
#18697 (comment):@@ -24,6 +24,7 @@ type containerStats struct {
NetworkTx float64
BlockRead float64
BlockWrite float64
- PidsCurrent uint64
That's setting cgroup value to the api type on daemon side. PidsCurrent
is client side value used for printing.—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/18697/files#r55465554.
Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can fix this if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
On Tuesday, March 8, 2016, Aleksa Sarai notifications@github.com wrote:
In api/client/stats_helpers.go
#18697 (comment):@@ -24,6 +24,7 @@ type containerStats struct {
NetworkTx float64
BlockRead float64
BlockWrite float64
- PidsCurrent uint64
I can fix this if you like.
—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/18697/files#r55476919.
Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also planning on adding PidsLimit to the stats as well so we can get the cool current / limit stuff all the other cgroups do. Obviously that'll take a while (libcontainer + engine-api + docker).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a PR fixing this (#21150).
|
Was this feature not included in the 1.11 released on 13th april? |
|
@mkonakan Yes, this is in Docker 1.11. |
|
@mkonakan it requires kernel 4.3 or up though, so may not be available if you're using an older version |
|
Cool. Thank you. I am currently on 1.10 only. I could not find this feature is included in the 1.11 release information. So, posted the question here. Will update and check on it. Thank you guys :) |
[--pids-limit](moby/moby#18697) [--security-opt=no-new-privileges](moby/moby#20727)
|
@innocentme1 There is no default, it's just what you set per container. |
|
Re-posting as my previous comment seems to be scrambled @cpuguy83 @cyphar I am currently not on kernel > 4.3 so I could not test things and I also could not find them in any docs. So, expecting your help for below ques 1- Is this PIDs limit enabled by default in Docker? How do I verify it? |
|
@cpuguy83 I would appreciate if I can get answers for each one of the one's I requested so that I can get clear idea on everything. So, if its per container level
|
|
@innocentme1 Please read the docs. |
|
p.s., if you would like to discuss further #docker on IRC or forums.docker.com is far more appropriate and easier to help out than a closed GH PR. |
|
@cpuguy83 sure. Thank you 👍 |
|
Any reason on why this wasn't added to |
|
Not really @matheuss, it should be fairly trivial to add to |
@jfrazelle gave me the honour of opening this on her behalf 😸.
The PIDs cgroup is vital to allowing the limiting of the number of processes with high granularity (on the level of containers). The other main options are simply not fit for the task:
LIMIT_NPROChas no granularity.docker run -u someonewill cause issues.opencontainers/runc#446 has been merged. We're waiting on
1.10to be released (as well as some issues inruncto be resolved).