8.9.4 Throttling I/O Bandwidth

Define a cgroup that limits the I/O bandwidth to 50MB/s when reading from /dev/sda1.

mount {
    blkio = /cgroup/iolimit;
}

group iocap1 {
    blkio  {
#       Limit reads from /dev/sda1 to 50 MB/s
        blkio.throttle.read_bps_device="8:1 52428800"; 
    }
}

Define a cgroup that limits the number of read transactions to 100 per second when reading from /dev/sdd.

mount {
    blkio = /cgroup/iolimit;
}

group iocap2 {
    blkio  {
#       Limit read tps from /dev/sdd to 100 per second
        blkio.throttle.read_iops_device="8:48 100";
    }
}

Define two cgroups with different shares of I/O access to /dev/sdb .

mount {
    blkio = /cgroup/iolimit;
}

# Low access share group
group iolo {
    blkio  {
#       Set the share of I/O access by /dev/sdb to 25%
        blkio.weight_device="8:16 250"; 
    }
}

# High access share group
group iohi {
    blkio  {
#       Set the share of I/O access by /dev/sdb to 75%
        blkio.weight_device="8:16 750"; 
    }
}