Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you configure I/O throttles on multiple block devices within one cgroup?

I have set up my system to use cgroups through the cgroup-bin package, which includes a few nice utilities for mounting and configuring cgroup subsystems. In my /etc/cgconfig.conf, I have a block like the following:

group limitio {
  blkio {
    blkio.throttle.read_bps_device = "<maj:min> 10485760";
  }
}

That works. However, I have multiple devices that I want to throttle I/O to. So, I tried listing them with several different delimiters but nothing seems to work.

Then I thought I would have cgsnapshot generate the configuration file for me from a manually configured machine. So I tried the following:

echo "<maj2:min2> 10485760" >> /path/to/limitio/blkio.throttle.read_bps_device

The manual update works and I see 2 lines in /path/to/limitio/blkio.throttle.read_bps_device but the following configuration, generated by cgsnapshot -s, does not work.

group limitio {
  blkio {
    blkio.throttle.read_bps_device = "<maj1:min1> 10485760
    <maj2:min2> 10485760";
  }
}

How do you make this work properly for more than 1 block devices without resorting to just creating separate subgroups?

Thank you!

like image 800
rutofproblems Avatar asked Nov 22 '25 15:11

rutofproblems


1 Answers

You can repeat the configuration for this namespace, with the new device value:

# limits for device 1:1
group limitio {
  blkio {
    blkio.throttle.read_bps_device = "<maj1:min1> 10485760";
  }
}

# limits for device 2:2
group limitio {
  blkio {
    blkio.throttle.read_bps_device = "<maj2:min2> 10485760";
  }
}
like image 120
Narcélio Filho Avatar answered Nov 25 '25 05:11

Narcélio Filho