Skip to content

add blkio.weight support#11802

Merged
jessfraz merged 1 commit intomoby:masterfrom
hqhq:hq_add_blkio_weight
May 8, 2015
Merged

add blkio.weight support#11802
jessfraz merged 1 commit intomoby:masterfrom
hqhq:hq_add_blkio_weight

Conversation

@hqhq
Copy link
Copy Markdown
Contributor

@hqhq hqhq commented Mar 26, 2015

We can use this to control block IO weight of a container.

Signed-off-by: Qiang Huang [email protected]

Comment thread docs/sources/reference/run.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@moxiegirl
Copy link
Copy Markdown
Contributor

Thanks for the contribution!

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Mar 26, 2015

This will require docs bump.

@hqhq hqhq force-pushed the hq_add_blkio_weight branch from 2cda03c to 713dbce Compare March 27, 2015 01:35
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented Mar 27, 2015

@moxiegirl Thanks for your suggestion, updated.

@moxiegirl
Copy link
Copy Markdown
Contributor

Thanks @hqhq --- much appreciated. I probably jumped the gun a bit commenting docs. This needs a code review.

Comment thread integration-cli/docker_cli_run_test.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you possibly start 2 containers, one with high weight and the other with low weight and make sure the high weight finished first ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also have test cases for invalid values or --blkio-weight?

@vieux
Copy link
Copy Markdown
Contributor

vieux commented Apr 15, 2015

code LGTM besides a few nits.

Can you also move the remote api doc change from 1.18 to 1.19 thanks!

@hqhq hqhq closed this Apr 16, 2015
@hqhq hqhq force-pushed the hq_add_blkio_weight branch from 713dbce to ad5d655 Compare April 16, 2015 07:16
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented Apr 16, 2015

Force update mistakenly close the PR, and I can't reopen it, somebody help?

@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented Apr 16, 2015

Sorry, my mistake, reopen it.

@hqhq hqhq reopened this Apr 16, 2015
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented Apr 16, 2015

Updated and rebased.

Comment thread daemon/create.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No \n at the end of the error message please (leave it to the printing code, if any)!

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Apr 17, 2015

I am not familiar and will have to check.
On Apr 16, 2015 12:33 PM, "Arnaud Porterie" [email protected]
wrote:

A thing that confuses me about the parameter value is the following:

kernel.org
https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt
says:

Currently allowed range of weights is from 10 to 1000.

-

RHEL docs
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch-Subsystems_and_Tunable_Parameters.html#blkio-weight
say:

[...] in the range 100 to 1000

Ping @vbatts https://github.com/vbatts: wdyt?


Reply to this email directly or view it on GitHub
#11802 (comment).

@hqhq hqhq force-pushed the hq_add_blkio_weight branch from 3634705 to 8c252aa Compare April 17, 2015 03:38
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented Apr 17, 2015

@icecrime Updated, thanks.

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Apr 17, 2015

after double checking, RHEL6 did not get that commit. RHEL6 minimum is 100.

@icecrime
Copy link
Copy Markdown
Contributor

Thanks for checking @vbatts! That's embarrassing, but I can't see us handling this at Docker level so I think we're just gonna go with the 10 to 1000 range, and docker run --blkio-weight=20 will most likely fail on RHEL.

LGTM 👍 Still good to you @vieux?

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Apr 17, 2015

@icecrime fairly narrow affected case. RHEL6 users, that call docker run with --blkio-weight and the value provided is 10-99, they'll get an invalid argument

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Apr 17, 2015

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.

@icecrime
Copy link
Copy Markdown
Contributor

Thanks @vbatts, sounds good!

@icecrime icecrime removed the dco/yes label Apr 23, 2015
@calavera
Copy link
Copy Markdown
Contributor

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.

Comment thread docs/man/docker-create.1.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

between 10 and 1000

(To be fully correct, "between 9 and 1001", but I don't think that will help anyone)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you missed this one :)

@hqhq hqhq force-pushed the hq_add_blkio_weight branch from 8c252aa to fa7f557 Compare May 7, 2015 02:29
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented May 7, 2015

@thaJeztah Thanks for your review, updated and rebased.

@thaJeztah
Copy link
Copy Markdown
Member

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]>
@hqhq hqhq force-pushed the hq_add_blkio_weight branch from fa7f557 to f133f11 Compare May 7, 2015 04:48
@hqhq
Copy link
Copy Markdown
Contributor Author

hqhq commented May 7, 2015

@thaJeztah Done, thanks.

jessfraz pushed a commit that referenced this pull request May 8, 2015
@jessfraz jessfraz merged commit de32f5c into moby:master May 8, 2015
@hqhq hqhq deleted the hq_add_blkio_weight branch May 8, 2015 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants