What is IOWait relative to the sar command and when should I be concerned?
The IOWait metric can be seen when viewing statistics with the sar command:
# sar -s 12:30:00
Linux 3.10.0-962.3.2.lve1.5.33.el7.x86_64 (cloudlinux-88.cpanel.ninja) 08/18/2020 _x86_64_ (4 CPU)
12:30:01 PM CPU %user %nice %system %iowait %steal %idle
12:40:01 PM all 0.24 0.30 0.31 0.02 0.02 99.11
12:50:01 PM all 0.18 0.32 0.27 0.02 0.02 99.19
01:00:01 PM all 0.24 0.31 0.31 0.03 0.03 99.10
01:10:01 PM all 0.22 0.30 0.29 0.06 0.02 99.11
01:20:01 PM all 0.23 0.32 0.31 0.03 0.03 99.08
Average: all 0.22 0.31 0.30 0.03 0.02 99.12
The man page provides the following explanation:
Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
In other words, IOWait is the amount of CPU time that is wasted waiting on I/O operations to complete.
For applications that run in the background and are not time-sensitive, low to moderate amounts of IOWait can be acceptable.
Although for web applications where load times are often expected to be sub 1 second and lower, even a small amount of IOWait can make a noticeable difference.
If you notice a decline in the performance of your application, and you can see that IOWait is above 1 - 4 percent, you should consider reaching out to a systems administrator that has the skills, training, and expertise to determine the cause for the IOWait, and what you can do to lower it.
Very high amounts of IOWait such as 60 percent almost always correlate with serious widespread issues on the server. This is an indication that the demands placed on the disks of your server have exceeded the threshold of the capabilities of the disks. You should recruit the assistance of a systems administrator to determine the best course of action to resolve the issue.