[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I/O Wait and CPU Usage



On Fri, May 11, 2007 at 07:43:50PM -0400, Grok Mogger wrote:
> I have a question about the "wa" fields in vmstat, top, and the 
> like.  I and someone else I know have both read a great deal 
> about its meaning, and have come to two different conclusions. 
> Here are our interpretations.  Could someone please tell me 
> which interpretation is right?  Thanks!
> 
> Interpretation A:
> 
> "wa" reflects time that your cpu is waiting on hard disks and 
> network.  It is basically the same as "idle" time.  If your CPU 
> had more work to do, it could do it.  So in a situation like 
> this....  (I'm simplifying the example to get the point across)
> 
> 10%us   10%sy   30%id   50%wa
> 
> The CPU is really truly 80% idle.  It's only using 20% of its 
> capacity, and if it had enough work to fill the remaining 80%, 
> it could and would.  You'd see 100% allocated between us and sy, 
> and 0% on id and wa.
> 
> In this interpretation, "wa" is really just helpful because it 
> tells you how much more of your CPU would be allocated between 
> us and sy if your hard disks and network could keep up with your 
> CPU.  It gives you some impression of the bottleneck your I/O 
> currently is on your PC.
 
I believe this to be the correct interpretation.

> Interpretation B:
> 
> "wa" reflects the time your CPU is waiting on hard disks and 
> network.  But it is NOT the same as "id".  If your CPU had more 
> work to do, it could not "allocate" wa time to that work, only 
> id time.  So in a situation like this....
> 
> 10%us   10%sy   30%id   50%wa
> 
> The CPU is really only 30% idle.  It's actually using a whopping 
> 70% of its capacity, and only has another 30% to allocate to 
> more work.  If the CPU had a ton of work to do, the best you'd 
> see is 50% allocated between us and sy, and 50% allocated to wa 
> with 0% id.
> 
> In this interpretation, "wa" is really like "blocked" CPU time. 
>  The CPU has processes that are not really doing anything, 
> because they are waiting on slow hard disks and network I/O, 
> *but* these waiting processes still prevent that much CPU from 
> being used.

A couple of experiments:

    # dd if=/dev/hda of=/dev/null

is obviously IO-bound. wa% goes sky-high, idle% goes toward zero.

    $ while true ; do 
    : 
    done

is cpu-bound. us% goes high, wa%, id% and ni% goes towards zero.

Finally, run both at the same time. Result: us% goes high, everthing 
else goes towards zero. This matches interpretation A, not B.

Hope this helps

-- 
Karl E. Jorgensen
karl@jorgensen.org.uk  http://www.jorgensen.org.uk/
karl@jorgensen.com     http://karl.jorgensen.com
==== Today's fortune:
love, v.:
	I'll let you play with my life if you'll let me play with yours.

Attachment: signature.asc
Description: Digital signature


Reply to: