I have tried without success to limit the disk IO of a LXD container named ci with:
lxc config device set ci root limits.read 30MB lxc config device set ci root limits.write 10MB
However, when running e.g. this command on the container:
dd if=/dev/zero of=/root/testfile bs=1G count=10 oflag=direct
the result is the whole capicity of the disk, which is about 130MB/s, instead of the expected result of about 10MB/s for writing operations:
10737418240 bytes (11 GB, 10 GiB) copied, 81,3877 s, 132 MB/s
This is also confirmed by
atop running on the host.
How can I effectively limit the disk IO of the container, so that no matter what happens on it, the host disk performance is not overcommitted?
On a second test, I run the same dd command as above at the same time on the guest and on the host, but the host is not prioritized either:
Some additional information:
Host and guest are Ubuntu 16.04
The server has two hard disks with equal partitions, joined in RAID 1 arrays
On top of the biggest RAID array the root filesystem is mounted on a LVM volume group
root@server ~ # lvs LV VG Attr LSize root vg0 -wi-ao---- 2,72t swap vg0 -wi-ao---- 4,00g
The LXD storage backend is dir
I could partitition the disk differently if that could help limiting disk IO of the container, e.g. having a RAID array dedicated to ZFS for LXD. Would that help?
I have posted this question also on https://serverfault.com/questions/858873/limiting-disk-io-on-lxd-containers