iowait 理解

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

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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值