why the performance monitor?
when it comes to the subject of disk performance in windows, the majority of questions can be quickly answered by performance monitor alone. performance monitor is very low overhead, does a great job with averages and can also capture and store data over long periods of time. it is an excellent choice to record a performance baseline and to troubleshoot.
for short in this text, we are going to call the windows performance monitor by its nickname: perfmon. the nickname comes from its executable file located at %systemroot%system32perfmon.exe.
there are some things perfmon will not be able to tell us. for advanced analysis, windows provides us with xperf, enabling state of the art performance data capture through event tracing for windows (etw). there is an excellent bog on the subject by robert smith (sr. pfe/sde). “analyzing storage performance using the windows performance analysis toolkit (wpt)”.
what is the difference between the physical disk vs. logical disk performance objects in perfmon?
perfmon has two objects directly related to disk performance, namely physical disk and logical disk. their counters are calculated in the same way but their scope is different.
the physical disk performance object monitors disk drives on the computer. it identifies the instances representing the physical hardware, and the counters are the sum of the access to all partitions on the physical instance.
the logical disk performance object monitors logical partitions. performance monitor identifies logical disks by their drive letter or mount point. if a physical disk contains multiple partitions, this counter will report the values just for the partition selected and not for the entire disk. on the other hand, when using dynamic disks the logical volumes may span more than one physical disk, in this scenario the counter values will include the access to the logical disk in all the physical disks it spans.
disk counters explained.
%disk time (% disk read time, % disk write time)
the “% disk time” counter is nothing more than the “avg. disk queue length” counter multiplied by 100. it is the same value displayed in a different scale.
if the avg. disk queue length is equal to 1, the %disk time will equal 100. if the avg. disk queue length is 0.37, then the %disk time will be 37.
this is the reason why you can see the % disk time being greater than 100%, all it takes is the avg. disk queue length value being greater than 1.
the same logic applies to the % disk read time and the % disk write time. their data comes from the avg. disk read queue length and avg. disk write queue length, respectively.
avg. disk queue length (avg. disks read queue length, avg. disk write queue length)
avg. disk queue length is equal to the (disk transfers/sec) *( disk sec/transfer). this is based on “little’s law” from the mathematical theory of queues. it is important to note this is a derived value and not a direct measurement, i recommend reading this article from mark friedman, the information still applies to windows 2008 r2.
as you would expect, the avg. disk read queue length is equal to the “(disk reads/sec) * (disk sec/read)” and avg. disk write queue length is equal to the “(disk writes/sec) * (disk sec/write)”.
current disk queue length
current disk queue length is a direct measurement of the disk queue present at the time of the sampling.
% idle time
this counter provides a very precise measurement of how much time the disk remained in idle state, meaning all the requests from the operating system to the disk have been completed and there is zero pending requests.
this is how it’s calculated, the system timestamps an event when the disk goes idle, then timestamps another event when the disk receives a new request. at the end of the capture interval, we calculate the percentage of the time spent in idle. this counter ranges from 100 (meaning always idle) to 0 (meaning always busy).
disk transfers/sec (disk reads/sec, disk writes/sec)
perfmon captures the total number of individual disk io requests completed over a period of one second. if the perfmon capture interval is set for anything greater than one second, the average of the values captured is presented.
disk reads/sec and disk writes/sec are calculated in the same way, but break down the results in read requests only or write requests only, respectively.
disk bytes/sec (disk read bytes/sec, disk write bytes/sec)
perfmon captures the total number of bytes sent to the disk (write) and retrieved from the disk (read) over a period of one second. if the perfmon capture interval is set for anything greater than one second, the average of the values captured is presented.
the disk read bytes/sec and the disk write bytes/sec counters break down the results displaying only read bytes or only write bytes, respectively.
avg. disk bytes/transfer (avg. disk bytes/read, avg. disk bytes/write)
displays the average size of the individual disk requests (io size) in bytes, for the capture interval. example: if the system had ninety nine io requests of 8k and one io request of 2048k, the average will be 28.4k. calculation = (8k*99) + (1*2048k) / 100
the avg. disk bytes/read and avg. disk bytes/write counters break down the results showing the average size for only read requests or only write requests, respectively.
avg. disk sec/transfer (avg. disk sec/read, avg. disk sec/write)
displays the average time the disk transfers took to complete, in seconds. although the scale is seconds, the counter has millisecond precision, meaning a value of 0.004 indicates the average time for disk transfers to complete was 4 milliseconds.
this is the counter in perfmon used to measure io latency.
i wrote a blog specifically about measuring latency with perfmon. for details got to “measuring disk latency with windows performance monitor”.
measures the rate of io split due to file fragmentation. this happens if the io request touches data on non-contiguous file segments. for an explanation about file segments see this blog from robert mitchell – the four stages of ntfs file growth.
logical disk counters exclusive counters
the logical disk performance object has all the same counters as the physical disk, and except for the fact they are reported per logical unit instead of physical device, they are calculated in the same way.
because the physical disk counter does not understand volumes, the following counters are exclusive to the logical disk object.
% free space
display the percentage of the total usable space on the selected logical disk that was free.
displays the unallocated space, in megabytes, on the volume.
how can we quickly tell how much free space is available in the volume? check this blog from robert mitchell – ntfs metafiles.
a few words about performance monitor counters averaging and rounding:
perfmon is really good at averaging results and rounding numbers, this enables us to have relatively small log files and extract useful the information from the data captured. although the numbers displayed to the user during a live capture and the numbers saved in the log files are rounded, the numbers used in the internal calculations are more precise.
when reading the description for some counters in this blog, you probably noticed perfmon has to calculate an average of averages, this leads to small imprecisions on the final numbers. also, when we combine this with instances that do further rounding and averaging, like the “ _total instance”, you will see some results are close but do not add up exactly. for example, if you get the “disk transfers/sec” over a period of time and subtract both the “disk reads/sec” and the “disk writes/sec” the resulting number may not be exactly zero.
this is expected and does not pose a problem to the performance analysis at this level. if you can’t tolerate these small imprecisions you will need to use xperf. xperf does event tracing and all data is kept with no averaging or rounding. the downside is the resulting log files with xperf are much bigger than the ones perfmon creates.
the windows performance monitor is a very powerful diagnostic tool and is capable of answering most questions about the state of disks on the fly. perfmon uses averaging and rounding to keep only meaningful data in its log files, thus allowing captures over a long period of time.