[lxc-users] Limiting disk IO on LXD containers [solved]

Ivan Ogai lxc-users at ogai.name
Tue Jul 11 07:47:13 UTC 2017


Correction on I/O limits on mdadm:

I was using the version available on the default repositories of Ubuntu
16.04, which was 10.0.9. After upgrading to 10.15 with

    sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable 
    sudo apt-get update
    sudo apt-get install lxd

the limit works on my setup (LVM on mdadm RAID 1), even without the need
to restart either the host nor the guest.

* Ivan Ogai <lxc-users at ogai.name> [2017-07-10 08:57]:
> 
> Addition for people interested on I/O limits on mdadm RAIDs (software
> RAIDs):
> 
> Currently I/O limits doesn't work on mdadm RAIDs. An issue for
> supporting it has been opened at
> 
> https://github.com/lxc/lxd/issues/3515
> 
> 
> * Ivan Ogai <lxc-users at ogai.name> [2017-07-06 12:30]:
> > Simos has already answered this question on 
> > 
> > https://discuss.linuxcontainers.org/t/limiting-disk-io-on-lxd-containers/261
> > 
> > I have also copied the answer on 
> > https://serverfault.com/questions/858873/limiting-disk-io-on-lxd-containers
> > 
> > In short: it works wtih ZFS and btrfs storage backend.
> > 
> > 
> > * Ivan Ogai <lxc-users at ogai.name> [2017-07-04 16:38]:
> > > Greetings LXCers/LXDers
> > > 
> > > Just in case: I have also posted this question in discuss and
> > > serverfault. By getting an answer here or there, I will answer the
> > > others of course for everyone to find them. References at the end.
> > > 
> > > 
> > > 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 at 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**?
> > > 
> > > 
> > > Question references:
> > > https://discuss.linuxcontainers.org/t/limiting-disk-io-on-lxd-containers/261
> > > https://serverfault.com/questions/858873/limiting-disk-io-on-lxd-containers
> > > 
> > > -- 
> > > Ivan
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list