Add the memory swappiness tuning option to docker.

Memory swappiness option takes 0-100, and helps to tune swappiness
behavior per container.
For example, When a lower value of swappiness is chosen
the container will see minimum major faults. When no value is
specified for memory-swappiness in docker UI, it is inherited from
parent cgroup. (generally 60 unless it is changed).

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Upstream-commit: b553af956f
Component: cli
This commit is contained in:
Raghavendra K T
2017-06-02 00:07:01 +00:00
committed by Tibor Vass
parent d25588047e
commit 88ba0fa858
5 changed files with 25 additions and 0 deletions
@@ -57,6 +57,7 @@ Creates a new container.
--privileged=false Give extended privileges to this container
--read-only=false Mount the container's root filesystem as read only
--restart="no" Restart policy (no, on-failure[:max-retry], always)
--memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
--security-opt=[] Security options
-t, --tty=false Allocate a pseudo-TTY
-u, --user="" Username or UID
@@ -58,6 +58,7 @@ weight=1
--read-only=false Mount the container's root filesystem as read only
--restart="no" Restart policy (no, on-failure[:max-retry], always)
--rm=false Automatically remove the container when it exits
--memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
--security-opt=[] Security Options
--sig-proxy=true Proxy received signals to the process
-t, --tty=false Allocate a pseudo-TTY
+15
View File
@@ -514,6 +514,7 @@ container:
--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-swappiness="": Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
### Memory constraints
@@ -611,6 +612,20 @@ The following example, illustrates a dangerous way to use the flag:
The container has unlimited memory which can cause the host to run out memory
and require killing system processes to free memory.
### Swappiness constraint
By default, a container's kernel can swap out a percentage of anonymous pages.
To set this percentage for a container, specify a `--memory-swappiness` value
between 0 and 100. A value of 0 turns off anonymous page swapping. A value of
100 sets all anonymous pages as swappable.
For example, you can set:
$ docker run -ti --memory-swappiness=0 ubuntu:14.04 /bin/bash
Setting the `--memory-swappiness` option is helpful when you want to retain the
container's working set and to avoid swapping performance penalties.
### CPU share constraint
By default, all containers get the same proportion of CPU cycles. This proportion