029、限制容器的block IO(2019-01-24 周四)

 
Block IO ,是另一种可以限制容器使用的资源,block IO 指的是磁盘的读写,docker 可以 设置权重、限制bps、限制iops
 
--blkio-weight 600
--device-read-bps /dev/vda:30MB
--device-write-bps /dev/vda:30MB
--device-read-iops /dev/vda:30
--device-write-iops /dev/vda:30
 
block IO的限额只对 direct IO 有效(不使用文件缓存),在使用dd测试的时候需要加上  oflag=direct
 
 
root@docker-lab:~# docker run -it --device-write-bps /dev/vda:30MB ubuntu
root@ac471e09c6f4:/# dd if=/dev/zero  of=dd bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.0756314 s, 1.4 GB/s
root@ac471e09c6f4:/# dd if=/dev/zero  of=dd bs=1M count=100 oflag=direct
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 3.51864 s, 29.8 MB/s
 
root@docker-lab:~# docker run -it --device-write-iops  /dev/vda:20 ubuntu
root@07d2655340d4:/# dd if=/dev/zero of=dd bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.0741201 s, 1.4 GB/s
root@07d2655340d4:/# dd if=/dev/zero of=dd bs=1M count=100 oflag=direct
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 9.951 s, 10.5 MB/s
 
 
 
上一篇:Performing User-Managed Database-18.4、Restoring Datafiles and Archived Redo Logs


下一篇:JDk和Mevan安装和配置