How to Check Disk Queue Length in Linux

The average disk queue length is the average number of read and write operations that were queued during a selected interval for the chosen device. It’s important to watch them as these values provide one of the representations of the storage performance. Higher values indicate that the quantity cannot continue with the requests from the appliance, leading to higher response times.

In this tutorial, we will learn how to check disk queue length using Linux commands.

Using iostat command

In Linux/ Unix system, iostat command is mostly used to generates statistics of input/output devices.

The iostat utility tool is part of the sysstat package. If not found, installed sysstat using the following command:

$ sudo apt install sysstat -y   [On ubuntu]
$ sudo yum install sysstat -y  [On centos]

To display average disk queue length use iostat with -x option, this will give extended stats. The field aqu-sz indicates the average queue length of the requests that were issued to the device or integral average over the number of IOs in progress. In the old versions, the field would be avgqu-sz.

$ iostat -x
iostat – Disk average queue length

Using sar command

Sar command is used to monitor the performance of Linux systems which includes CPU, Memory, and I/O in real-time. Sar is part of the sysstat packge.

Sar command with -d option displays activity for each block device. To print, the statistics with the actual device name add another -p option.

The field aqu-sz helps to find average queue length. The field is same for iostat command.

$ sar -p -d 1 1 
sar command – check disk queue length

From /proc/diskstats

The /proc/diskstats file displays the I/O statistics of block devices. The result returned by this command is always the raw value.

From kernel version 5.5+, /proc/diskstats contains a total of 20 fields.

#14 – weighted time spent doing I/Os (ms)

The average disk queue length can be calculated by checking data changes in the 14th field in a period of time.

To display the content of the /proc/diskstats and filter by specific disk, type:

$ cat /proc/diskstats | grep 'sda'

Output:

8       0 sda 15728 6935 1377412 10839 28870 15373 995570 49457 0 36360 60296 0 0 0 0 0 0

Conclusion

In this tutorial, we learned about different command-line utility tools to check disk queue length in the Linux system.

#Check #Disk #Queue #Length #Linux

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: