我对如何解释 procfs-diskstats 的结果感兴趣。它看起来像一个 API,但我在 Internet、手册页或 Linux 内核文档中没有看到详尽的解释。
有一个文件有一个非常简洁的描述:
The /proc/diskstats file displays the I/O statistics
of block devices. Each line contains the following 14
fields:
== ===================================
1 major number
2 minor mumber
3 device name
4 reads completed successfully
5 reads merged
6 sectors read
7 time spent reading (ms)
8 writes completed
9 writes merged
10 sectors written
11 time spent writing (ms)
12 I/Os currently in progress
13 time spent doing I/Os (ms)
14 weighted time spent doing I/Os (ms)
== ===================================
...
并且iostats.rst再说几句话。但仍然很难说出这个指标的确切含义:
13 time spent doing I/Os (ms)
来自 iostats.rst:
Field 10 -- # of milliseconds spent doing I/Os (unsigned int)
This field increases so long as field 9 is nonzero.
Since 5.0 this field counts jiffies when at least one request was
started or completed. If request runs more than 2 jiffies then some
I/O time might be not accounted in case of concurrent requests.
但是当我看到这个值时每秒在我的 4 核 CPU 虚拟机上,该值增长(增量)超过100000毫秒复制 fe 4Gb 文件时。
我可以假设硬盘/固态硬盘(SATA?取决于总线?)可以并行处理多个 CPU 核心请求。
在 4 核 CPU 上,这意味着该计数器中的 100000 毫秒增量代表每秒 HDD/SDD 服务 [每个 CPU 核心的请求至少 25 秒]。或者在两个核心上 50 秒(每秒),或在 1 个核心上 100 秒(每秒)。
常识告诉我们,每秒的工作时间不能超过一秒。
相关帖子:/proc/diskstats 磁盘读取时间每秒增加超过一秒
UPD:Linux 内核 4.4.161,x86_64