linux - Change swappiness for docker container -
i using docker containerize bunch of services. times, containerized services heavily swaps. i've changed vm.swappiness
1
via sysctl on host system. docker's memory cgroup still have old (default) value of 60. therefore, particular containers' cgroups have same value, parent.
sysctl vm.swappiness > vm.swappiness = 1 cat /sys/fs/cgroup/memory/docker/memory.swappiness > 60 cat /sys/fs/cgroup/memory/docker/${container_id}/memory.swappiness > 60
all attempts change swappiness manually (by echoing desired value memory.swappiness
file) fails permission denied
.
subject: how can restrict containers swappiness?
i using ubuntu 12.04
kernel 3.13
, docker version 1.1.2
native execution driver (not lxc) of version 0.2
. kernel loaded cgroup_enable=memory swapaccount=1
.
if upgrade 3.18 kernel or later, restriction preventing modification cgroup memory.swappiness
parameter in child/hierarchy cgroups removed. linux kernel patch removed restriction can seen here: https://github.com/torvalds/linux/commit/3dae7fec5e884a4e72e5416db0894de66f586201
docker 1.8 include following pr (https://github.com/docker/docker/pull/14004) allows container set own memory.swappiness
value allowing user control on cgroup setting, long docker daemon host kernel has patch noted above, or host kernel 3.18 or greater.
Comments
Post a Comment