ユーザ用ツール

サイト用ツール


01_linux:21_centos7:07_cgroup

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
01_linux:21_centos7:07_cgroup [2021/07/18 12:39] matsui01_linux:21_centos7:07_cgroup [2021/07/24 08:30] (現在) matsui
行 31: 行 31:
  
  
 +==== cgconfig.confで複数ディスクへ設定する場合 ====
 +groupを複数書いておく
 +
 +  [/etc/cgconfig.conf]
 +  
 +  group DiskIO_Group  {
 +      blkio {
 +          blkio.throttle.read_iops_device = "8:0 100";
 +          blkio.throttle.write_iops_device = "8:0 100";
 +      }
 +  }
 +  group DiskIO_Group  {
 +      blkio {
 +          blkio.throttle.read_iops_device = "251:0 100";
 +          blkio.throttle.write_iops_device = "251:0 100";
 +      }
 +  }
 +
 +こうするとちゃんと反映される
 +<code>
 +# cat /sys/fs/cgroup/blkio/DiskIO_Group/blkio.throttle.write_iops_device 
 +8:0 100
 +251:0 100
 +</code>
 ===== 反映 ===== ===== 反映 =====
 反映にはcgconfigとcgredプロセスを再起動で反映されます。 反映にはcgconfigとcgredプロセスを再起動で反映されます。
行 42: 行 66:
  
 <code> <code>
-# dd if=/dev/zero of=AAA bs=4k count=1000 oflag=direct+# dd if=/dev/zero of=AAA bs=512 count=100 oflag=direct 
 +100+0 records in 
 +100+0 records out 
 +51200 bytes (51 kB) copied, 0.925756 s, 55.3 kB/s 
 + 
 +# dd if=/dev/zero of=AAA bs=512 count=1000 oflag=direct
 1000+0 records in 1000+0 records in
 1000+0 records out 1000+0 records out
-4096000 bytes (4.1 MB) copied, 9.92628 s, 413 kB/s+512000 bytes (512 kB) copied, 9.92528 s, 51.6 kB/s
 </code> </code>
 +
 +
 +===== コマンドラインで実行の場合 =====
 +
 +==== CGruleを先に設定しておく ====
 +  echo "root blkio DiskIO_Group" >>  /etc/cgrules.conf
 +  systemctl restart cgred
 +
 +==== グループ作成 ====
 +
 +  cgcreate -g blkio:/DiskIO_Group
 +
 +==== 設定追加 ====
 +
 +  cgset -r blkio.throttle.write_iops_device="8:0 10" DiskIO_Group
 +
 +==== 設定確認 ====
 +
 +  cgget blkio.throttle.write_iops_device DiskIO_Group
 +
 +  # cgget -r blkio.throttle.write_iops_device DiskIO_Group
 +  DiskIO_Group:
 +  blkio.throttle.write_iops_device: 8:0 10
 +  
 +下記でも確認できる
 +  # cat /sys/fs/cgroup/blkio/DiskIO_Group/blkio.throttle.write_iops_device
 +  8:0 10
 +
 +==== 設定削除 ====
 +  cgdelete blkio:/DiskIO_Group
 +
  
 {{tag>centos}} {{tag>centos}}
01_linux/21_centos7/07_cgroup.1626611997.txt.gz · 最終更新: 2021/07/18 12:39 by matsui