【问题标题】:Restrict IO usage using cgroups [closed]使用 cgroups 限制 IO 使用 [关闭]
【发布时间】:2015-03-03 11:32:22
【问题描述】:

我正在尝试使用 cgroups 在我的服务器上限制 Io 使用。

这是我的分区表信息:

major minor  #blocks  name    
   8        0   10485760 sda
   8        1    9437184 sda1
   8        2    1047552 sda2

这是我的文件系统结构:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       8.9G  8.4G   37M 100% /
none           1004M     0 1004M   0% /dev/shm

当我尝试执行以下命令时:

回显 "8:1 10485760" > /cgroup/blkio/test2/blkio.throttle.write_bps_device

我得到的输出为:

-bash: echo: write error: No such device

这是我的 cgroups 配置:

mount { 
    blkio = /cgroup/blkio;      
}

group test2 {
    blkio {
        blkio.throttle.write_iops_device="";
        blkio.throttle.read_iops_device="";
        blkio.throttle.write_bps_device="";
        blkio.throttle.read_bps_device="";
        blkio.weight="";
        blkio.weight_device="";
    }
}

为什么我不能限制 /dev/sda1 IO 的使用?

【问题讨论】:

    标签: linux performance io centos cgroups


    【解决方案1】:

    设置 blkio 时需要使用物理设备。对整个磁盘使用major:minor (8:0)。

    【讨论】:

    • 感谢您的回复。它适用于读取限制,但我想限制 io 写入操作我已设置 blkio.throttle.write_bps_device="8:0 10485760";
    猜你喜欢
    • 2016-10-24
    • 1970-01-01
    • 1970-01-01
    • 2017-01-05
    • 1970-01-01
    • 1970-01-01
    • 2012-03-19
    • 1970-01-01
    • 2015-06-02
    相关资源
    最近更新 更多