监控磁盘IO

2020-07-19  本文已影响0人  wayyyy

磁盘工作原理

磁盘性能指标
查看磁盘扇区大小信息
fdisk -l
image.png
查看磁盘使用情况
df -h
image.png
dd 命令生成测试文件测试

磁盘基准测试工具fio

安装
# ubuntu
apt-get install -y fio
# centos
yun install -y fio
测试随机写
测试随机读
fio -name=randread -direct=1 -iodepth=64 -rw=randread \
-ioengine=libaio -bs=4k -size=1G -numjobs=1 \
-runtime=1000 -group_reporting -filename=/dev/vda1
测试顺序读
测试顺序写
报告

iostat

iostat监控的请求数量,并不是我们进程中执行read的数量,而是具体对磁盘扇区操作请求的数量

iostat -x 1 
image.png
  • r/s
    The number (after merges) of read requests completed per second for the device
  • w/s
    The number (after merges) of write requests completed per second for the device
  • rrqm/s
    The number of read requests merged per second that were queued to the device
  • wrqm/s
    The number of write requests merged per second that were queued to the device
  • r_awati
    The average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
  • avgrq-sz
    The average size (in kilobytes) of the I/O requests that were issued to the device.
  • await:平均每个 I/O 花费的时间,包括在队列中等待时间以及磁盘控制器中真正处理的时间
  • svctm:每个 I/O 的服务时间。
  • util:磁盘的繁忙程度,如果该值很高,表示IO很高。若要看是哪些个进程占用IO,使用下面的iotop命令。

sar命令

sar -b 1 3
image.png

iotop

前面的命令都是系统整体展示,iotop命令类是top 可以查看各个进程的io情况:

image.png

pidstat

定位IO瓶颈问题

上一篇 下一篇

猜你喜欢

热点阅读