linux 2.6.37 の新機能 "I/O throttling" (2)
昨日の『linux 2.6.37 の新機能 "I/O throttling"』の続編.
# ls -l /dev/sdc* brw-rw---- 1 root disk 8, 32 1月 12日 19:01 /dev/sdc brw-rw---- 1 root disk 8, 33 1月 12日 19:02 /dev/sdc1
というディスクに対して
まずは書き込み.
# mount -t cgroup -o blkio blkio /blkio # mount /dev/sdc1 /mnt # echo "8:32 1048576" > /blkio/blkio.throttle.write_bps_device # cat blkio.throttle.write_bps_device 8:32 1048576 # cd /mnt # dd if=/dev/zero of=zerofile bs=4K count=1024 oflag=direct 1024+0 records in 1024+0 records out 4194304 bytes (4.2 MB) copied, 4.00056 s, 1.0 MB/s
次に読み込み
# echo "8:32 1048576" > /blkio/blkio.throttle.read_bps_device # cat blkio.throttle.read_bps_device 8:32 1048576 # cd /mnt # dd if=zerofile of=/dev/null bs=4K count=1024 iflag=direct 1024+0 records in 1024+0 records out 4194304 bytes (4.2 MB) copied, 4.00064 s, 1.0 MB/s
ハイ,とりあえず制限は効いているようです.
念のため上記のように制限をかけたあと,対象デバイスに対して 0 を設定すると,設定がなくなって,制限も効いていないのが確認出来ます.
# echo "8:32 0" > /blkio/blkio.throttle.write_bps_device # cat /blkio/blkio.throttle.write_bps_device # echo "8:32 0" > /blkio/blkio.throttle.read_bps_device # cat /blkio/blkio.throttle.read_bps_device # dd if=/dev/zero of=zerofile bs=4K count=1024 oflag=direct 1024+0 records in 1024+0 records out 4194304 bytes (4.2 MB) copied, 0.216398 s, 19.4 MB/s # dd if=zerofile of=/dev/null bs=4K count=1024 iflag=direct 1024+0 records in 1024+0 records out 4194304 bytes (4.2 MB) copied, 0.128186 s, 32.7 MB/s