mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
add blkio.weight support
We can use this to control block IO weight of a container. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
@@ -149,6 +149,7 @@ Create a container
|
||||
"CpuShares": 512,
|
||||
"CpusetCpus": "0,1",
|
||||
"CpusetMems": "0,1",
|
||||
"BlkioWeight": 300,
|
||||
"OomKillDisable": false,
|
||||
"PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
|
||||
"PublishAllPorts": false,
|
||||
@@ -195,6 +196,7 @@ Json Parameters:
|
||||
- **Cpuset** - The same as CpusetCpus, but deprecated, please don't use.
|
||||
- **CpusetCpus** - String value containing the cgroups CpusetCpus to use.
|
||||
- **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
|
||||
- **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
|
||||
- **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
|
||||
- **AttachStdin** - Boolean value, attaches to stdin.
|
||||
- **AttachStdout** - Boolean value, attaches to stdout.
|
||||
@@ -341,6 +343,7 @@ Return low-level information on the container `id`
|
||||
"ExecIDs": null,
|
||||
"HostConfig": {
|
||||
"Binds": null,
|
||||
"BlkioWeight": 0,
|
||||
"CapAdd": null,
|
||||
"CapDrop": null,
|
||||
"ContainerIDFile": "",
|
||||
|
||||
@@ -941,6 +941,7 @@ Creates a new container.
|
||||
|
||||
-a, --attach=[] Attach to STDIN, STDOUT or STDERR
|
||||
--add-host=[] Add a custom host-to-IP mapping (host:ip)
|
||||
--blkio-weight=0 Block IO weight (relative weight)
|
||||
-c, --cpu-shares=0 CPU shares (relative weight)
|
||||
--cap-add=[] Add Linux capabilities
|
||||
--cap-drop=[] Drop Linux capabilities
|
||||
@@ -1898,6 +1899,7 @@ To remove an image using its digest:
|
||||
|
||||
-a, --attach=[] Attach to STDIN, STDOUT or STDERR
|
||||
--add-host=[] Add a custom host-to-IP mapping (host:ip)
|
||||
--blkio-weight=0 Block IO weight (relative weight)
|
||||
-c, --cpu-shares=0 CPU shares (relative weight)
|
||||
--cap-add=[] Add Linux capabilities
|
||||
--cap-drop=[] Drop Linux capabilities
|
||||
|
||||
@@ -483,6 +483,7 @@ container:
|
||||
--cpuset-cpus="": CPUs in which to allow execution (0-3, 0,1)
|
||||
--cpuset-mems="": Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
|
||||
--cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||
--blkio-weight=0: Block IO weight (relative weight) accepts a weight value between 10 and 1000.
|
||||
--oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not.
|
||||
|
||||
### Memory constraints
|
||||
@@ -654,6 +655,30 @@ Linux Scheduler used by the kernel. Set this value to 50000 to limit the contain
|
||||
to 50% of a CPU resource. For multiple CPUs, adjust the `--cpu-quota` as necessary.
|
||||
For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt).
|
||||
|
||||
### 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:
|
||||
|
||||
$ docker run -ti --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
|
||||
$ 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.
|
||||
|
||||
## Runtime privilege, Linux capabilities, and LXC configuration
|
||||
|
||||
--cap-add: Add Linux capabilities
|
||||
|
||||
Reference in New Issue
Block a user