1 What exactly is "iowait"?
'iowait' is the percentage of time the CPU is idle AND there is at least one I/O in progress.
If the CPU is idle, the kernel then determines if there is at least one I/O currently in progress to either a local disk or a remotely mounted disk (NFS) which had been initiated from that CPU. If there is, then the 'iowait' counter is incremented by one. If there is no I/O in progress that was initiated from that CPU, the 'idle' counter is incremented by one.
%iowait = (time cpu is idle but have I/O in process) / (all cpu time)

2、iowait 有时候是有意义的,有时候没有意义。
2.1 优化磁盘I/O,更换更快的硬盘 -- 降低 iowait
Example 1: Let's say that a program needs to perform transactions on behalf of a batch job. For each transaction, the program will perform some computations which takes 10 milliseconds and then does a synchronous write of the results to disk. Since the file it is writing to was opened synchronously, the write does not return until the I/O has made it all the way to the disk. Let's say the disk subsystem does not have a cache and that each physical write I/O takes 20ms. This means that the program completes a transaction every 30ms. Over a period of 1 second (1000ms), the program can do 33 trans

本文详细解释了Linux系统中'iowait'的含义,它表示CPU空闲并有I/O操作进行的时间占比。通过例子展示了'iowait'在磁盘I/O优化、系统性能评估和问题诊断中的作用。优化I/O子系统可以显著降低'iowait',提高程序吞吐量。同时,高'iowait'并不总是问题,而'iowait'为0也不代表没有I/O问题。最后,同样的工作负载在不同系统中,'iowait'值可能有很大差异。
最低0.47元/天 解锁文章
1736

被折叠的 条评论
为什么被折叠?



