I'm using WMI to query the current and average disk queue length of remote machines to be able to monitor the load on the hard drive. The query is as follows:
select CurrentDiskQueueLength, AvgDiskQueueLength, Name
from win32_perfformatteddata_perfdisk_physicaldisk
The results that I'm getting returned is confusing; I find that I am getting consistently (much!) higher total (i.e. for Name = _Total) results for average disk queue lengths compared to the current disk queue length. A graph of this is as follows:
where the purple line corresponds to the total average disk queue length and the green line corresponds to the current disk queue length.
And so my question: how is the average disk queue length computed? How can it be so much higher compared to the current disk queue length when I would assume that the average disk queue length is computed by taking several 'current' values in the past and taking the average of those? Does the average value depend on the frequency at which I run this query?
This does seem strange. If you use Perfmon to record the same data are the values that perfmon returns the same as your WMI script returns? If not it's a problem with WMI (or of course your script ;-).
JR
When you ask for the current value you get the current queue length: nothing else. When you ask for the average you will get the queue length averag taken over what-ever period Windows uses.
If there was a sudden burst of activity (either a short very heavy burst, or a lower but longer one) between the two "current" readings you took that might be reflected in the average but, unless the burst of activity is happening right now, not in the current value at all.
It might be a little odd that you get consistent values for "current" even when the average is high for three or four readings, but as the current is sometimes higher than the average I would suggest that the readings are actually correct.
I'm not sure what the period used for the average is, but you might find it if you search for the exact counter name in the MSDN site.
Those values are not straightforward and meaningful. They have to be interpreted. From O'Reilly's Top 6 FAQs on Windows 2000 Disk Performance: