I can't get the cgroup blkio to throttle the iops of processes in a sub-cgroup. I am using CentOS 7, 3.10.0-229. I create the cgroup /sys/fs/cgroup/blkio/user.slice/test1 and do

echo 8:32 10 > /sys/fs/cgroup/blkio/user.slice/test1/blkio.throttle.read_iops_device

and likewise for write_iops_device. 8:32 corresponds to HDD at /dev/sdc. I then use stress-ng to read and write to the drive at /srv/hdd-c using

cgexec -g blkio:user.slice/test1 stress-ng --temp-path /srv/hdd-c --hdd 15 -t 180


cgexec -g blkio:user.slice/test1 stress-ng --temp-path /srv/hdd-c --readahead 15 -t 180

I confirmed that the 30 processes launched are running in the blkio:user.slice/test1 cgroup using ps eo pid,user,args,cgroup.

When I do iostat 5 the number of tps for sdc is 400 to 600, which is the same as when I run them outside the test1 cgroup. I get the same result if I do echo 8:32 10 > /sys/fs/cgroup/blkio/user.slice/blkio.throttle.{read|write}_iops_device and run them in the user.slice or user.slice/test1 cgroup. However, if I throttle at the root of blkio using echo 8:32 10 > /sys/fs/cgroup/blkio/blkio.throttle.{read|write}_iops_device, and then run stress-ng processes, iostat 5 shows the tps for sdc is 10-11.

Does blkio throttling only work at the root level? The manual pages does not seem to suggest that.


So the issue, which I learned from the answer to this question, is that kernel buffering bypasses the blkio system. Using fio with no buffering and directio I was able to throttle the iops to a device to 10 per second using echo 8:32 10 > /sys/fs/cgroup/blkio/user.slice/blkio.throttle.{read|write}_iops_device

| improve this answer | |

I got the same result as you, but found that if I used


that will limit throughput when the device is being used as a filesystem.

| improve this answer | |
  • Ken, thanks for the tip. What is the version of the kernel you tested that on? – Jeff Kubina Aug 15 '19 at 18:22
  • 1
    AWS Linux - 4.14 – Ken Tune Aug 21 '19 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.