add blkio.weight support#11802
Conversation
b500e5a to
2cda03c
Compare
There was a problem hiding this comment.
A better structure for this is: https://gist.github.com/fb433f62445d80cacf48.git
In tech docs, you typically don't want to talk about features that "might" be coming. Creates an anticipation in the reader that may or may not ever be resolved. A feature either is or is not available.
--->
Block IO bandwidth (Blkio) constraint
By default, all containers get the same proportion of block IO bandwidth
(blkio). This proportion is 500. To modify this proportion, change the
container's blkio weight relative to the weighting of all other running
containers using the --blkio-weight flag.
The --blkio-weight flag can set the weighting to a value between 10 to 1000.
For example, the commands below create two containers with different blkio
weight:
$ sudo docker run -ti --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
$ sudo docker run -ti --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash
If you do block IO in the two containers at the same time, by, for example:
time dd if=/mnt/zerofile of=test.out bs=1M count=1024 oflag=direct
You'll find that the proportion of time is the same as the proportion of blkio
weights of the two containers.
Note: The blkio weight setting is only available for direct IO. Buffered IO
is not currently supported.
|
Thanks for the contribution! |
|
This will require docs bump. |
2cda03c to
713dbce
Compare
|
@moxiegirl Thanks for your suggestion, updated. |
|
Thanks @hqhq --- much appreciated. I probably jumped the gun a bit commenting docs. This needs a code review. |
There was a problem hiding this comment.
Could you possibly start 2 containers, one with high weight and the other with low weight and make sure the high weight finished first ?
There was a problem hiding this comment.
That would be a bit difficult, but doable, the thing is I think it's not necessary.
All Docker needs to be sure is that we write the right value into cgroup files, the functionality is guarantied by cgroup, which is kernel's job. And we don't need to test kernel functionality in Docker. Otherwise, all other resource configs need test to make sure if these resource limit really work. WDYT?
There was a problem hiding this comment.
Can we also have test cases for invalid values or --blkio-weight?
|
code LGTM besides a few nits. Can you also move the remote api doc change from |
713dbce to
ad5d655
Compare
|
Force update mistakenly close the PR, and I can't reopen it, somebody help? |
|
Sorry, my mistake, reopen it. |
|
Updated and rebased. |
There was a problem hiding this comment.
No \n at the end of the error message please (leave it to the printing code, if any)!
|
I am not familiar and will have to check.
|
3634705 to
8c252aa
Compare
|
@icecrime Updated, thanks. |
|
after double checking, RHEL6 did not get that commit. RHEL6 minimum is 100. |
|
@icecrime fairly narrow affected case. RHEL6 users, that call |
|
We don't have to hold up this PR on RHEL6. I've opened a request for torvalds/linux@df457f8 in this bz https://bugzilla.redhat.com/show_bug.cgi?id=1212931 (permissions of this bz may change over time). I'll look to add docs (... somewhere) about the narrow case. |
|
Thanks @vbatts, sounds good! |
|
Code LGTM. @hqhq this needs a rebase, but I'm moving it to docs review so we can get it one step closer. I'll still check the code again before landing it in master. |
There was a problem hiding this comment.
between 10 and 1000
(To be fully correct, "between 9 and 1001", but I don't think that will help anyone)
There was a problem hiding this comment.
Looks like you missed this one :)
|
@thaJeztah Thanks for your review, updated and rebased. |
|
Thanks, @hqhq. Looks like you missed one (#11802 (comment)). LGTM (after that one is fixed) cc @fredlf @moxiegirl @jamtur01 @SvenDowideit (why doesn't @docker/docs-owners work?) |
We can use this to control block IO weight of a container. Signed-off-by: Qiang Huang <[email protected]>
|
@thaJeztah Done, thanks. |
We can use this to control block IO weight of a container.
Signed-off-by: Qiang Huang [email protected]