Debugging disk I/O on Linux servers

Disk I/O latency can significantly slow down service response time, particularly on the data server. Use the kSar and iostat utilities to examine disk activity and to check for high rates of disk use on the Linux servers.

Analyzing disk usage with ksar

On each server, examine the graphical output from the ksar utility to check for high rates of disk use.
  • The disk usage for each device is displayed in the Disk section. For example, click Disk > sdb > Block Wait in the navigation pane to display latency and usage information for the sdb device. The disk usage for the device is displayed under Util%. Typically, the value that is displayed should be in the 0-25% range to allow for periodic peaks in disk activity. Significant disk I/O latency occurs when a value in the 75-100% range is consistently displayed, and this results in increased response times if the device is used for table spaces or database transaction logs.
  • When you examine CPU usage, click Show CPU used stacked from the Options menu. Each component of CPU time will be displayed in a stack. The red band in a stack indicates I/O wait time. A significant red band indicates latency issues for one or more devices on that server. On the data server, latency issues typically occur when the disk storage is configured incorrectly. For more information about guidelines for configuring DB2® disk storage, see Database storage.

Analyzing disk usage with iostat

Use the iostat utility, which is provided with the sysstat package, to display disk activity for each device on a server. You can also run the iostat command in batch mode to output disk activity figures at regular intervals to a file. For example, enter the following command as a root user on a server to output 10 iterations of statistics every 10 seconds to file:
iostat -d -k -t -N -x 10 10 > iostat_output.txt &
The following sample iostat output indicates significant disk-read activity for the sdb device:
03/23/2018 03:46:05 PM
Device: rrqm/s   wrqm/s     r/s    w/s    rkB/s   wkB/s avgrq-sz avgqu-sz  await  svctm  %util
sda       0.00     2.28    0.37   1.32    27.87   14.40    50.22     0.00   2.34   1.52   0.26
sdb       0.00     4.05 5514.38  59.35 25594.43  580.80     9.39     2.03   0.37   0.15  83.95

03/23/2018 03:47:05 PM
Device: rrqm/s   wrqm/s     r/s    w/s    rkB/s   wkB/s avgrq-sz avgqu-sz  await  svctm  %util
sda       0.00     1.37    0.00   1.10     0.00    9.87    17.94     0.00   1.39   0.62   0.07
sdb       0.00     2.47 5388.98  18.07 24925.82  198.08     9.29     2.03   0.38   0.13  71.15

Analyzing disk usage with iotop

To examine I/O activity at a process level, install and run the iotop command. You can also run the command in batch mode to examine the cumulative contribution to the overall read and write I/O for each running process. For example, enter the following command as a root user on a server to output 10 iterations of statistics every 10 seconds to the iotop_output.txt file:
iotop -P -o -t -a -d 10 -n 10 -b > iotop_output.txt &