如何在 Linux 上显示当前磁盘 IO 队列长度?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13613550/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 17:54:46  来源:igfitidea点击:

How do I display the current disk IO queue length on Linux?

linuxiokernelblockscheduler

提问by KZcoding

I am working on a new IO scheduler for the Linux Kernel. I am trying to see if anyone knows of a tool that prints out total number of outstanding IO requests (Disk IO queue) in Linux?

我正在为 Linux 内核开发一个新的 IO 调度程序。我想看看是否有人知道在 Linux 中打印出未完成 IO 请求(磁盘 IO 队列)总数的工具?

I would be working from a terminal.

我将从终端工作。

Thank you!

谢谢!

回答by Dmitry Zagorulkin

dmitry@pro:~$ iostat 
          disk0       cpu     load average
    KB/t tps  MB/s  us sy id   1m   5m   15m
   50.70  34  1.70   4  3 93  1.83 1.65 1.70
dmitry@pro:~$ 

DESCRIPTION Iostat displays kernel I/O statistics on terminal, device and cpu opera- tions. The first statistics that are printed are averaged over the sys- tem uptime. To get information about the current activity, a suitable wait time should be specified, so that the subsequent sets of printed statistics will be averaged over that time.

描述 Iostat 显示关于终端、设备和 CPU 操作的内核 I/O 统计信息。打印的第一个统计数据是系统正常运行时间的平均值。要获取有关当前活动的信息,应指定合适的等待时间,以便后续打印的统计数据集在该时间段内进行平均。

回答by daveh

Forgive the massive necro here. You actually want iostat -xwhich will display the extended stats for the device in question since last iostat was run. If you wish to monitor the queue in realtime you want iostat -xt 1(or iostat -xmt 1to show details in megabytes).

原谅这里的巨大死灵。您实际上想要iostat -x哪个将显示自上次运行 iostat 以来相关设备的扩展统计信息。如果您希望实时监控您想要的队列iostat -xt 1(或iostat -xmt 1以兆字节显示详细信息)。

You can see the average queue size in the avgqu-szcolumn.

您可以在avgqu-sz列中看到平均队列大小。

Consider the following example output from iostat -xmt 1which shows a full IO queue (max queue length is 128 for this device) and a saturated disk during a benchmark.

考虑以下示例输出,iostat -xmt 1其中显示了一个完整的 IO 队列(此设备的最大队列长度为 128)和基准测试期间的饱和磁盘。

18/05/15 00:41:05
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    6.02    0.00   93.98

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await  svctm  %util
xvda              0.00     0.00    1.00 1308.00     0.00   163.50   255.81   133.30  101.15   0.76 100.00