How to use Windows Perfmon in an efficient way to troubleshoot performance. For many years the Performance Monitor tool has been available in Windows Server operating systems, and is a great tool with literally thousands of counters, but is sometimes a bit hard to start working with. We will see some easy tips how make Perfmon really useful.
The first thing to make sure is that you can reuse the changes you make. Adding the correct counters together with some other configuration can take quite some time and we want to be able to save all our settings. The ability to save is somewhat less intuitive in Windows 2008 R2. A common way to start Performance Monitor is to type “perfmon” in RUN or from the command prompt, but this should not be used in Windows 2008 R2 due to the lack of a possibility to save your settings.
The best way is to first start a MMC console (type “mmc“), then add the Performance Monitor as a snap-in. We will see later that it is useful to have several instances of perfmon in the same MMC. This works on 2008 and 2008 R2, but not Windows 2003. Note also that the Perfmon snapin is called “Reliability and Performance Monitor” on Windows 2008.
This allows you the later save all settings and reuse another day or on another server. Now add the different counters you want to study. In another post I will describe the most interesting counters for measuring CPU, Memory, Disk, Networking, Active Directory and other.
Make sure to save the whole MMC configuration from the file menu. Place the *.msc file on some suitable location.
A very important setting is the time range you are interested in observing. All Windows server versions have a default display time of 1 minute and 40 seconds, that is: we do only see the performance statistics for less than two minutes. Often this default value is non practical, since the time windows observed is very small and the displayed information is overwritten quickly.
It is however not totally straightforward to change this and it is somewhat different on Windows 2003 and Windows 2008/R2. We will begin to study the settings for the 2008 and R2 server versions. Right click Performance Monitor and select Properties.
On the General tab we the default settings as above: Sample Every and Duration. These settings determine how much data we can observe at the same time in one Perfmon windows. Very often it is not only interesting to see the value at one given moment, but the see how the performance counters fluctuates during several hours.
On Windows 2008/R2 we can show up to 1000 “points in time” values in the same view. That is: on the same screen we have space for 1000 different performance reads and we must decide how to use them. Default is to only see the last 100 seconds (1 minute and 40 seconds) which is way to short to use for anything.
So first determine the length of time we want to study. For example it could be interesting to see how the CPU usage varies over two hours time or if the latencies to the SAN is higher over some peak periods during the work day. Let us say we want to see 8 hours of statistics at the same time. First calculate the total number of seconds. E.g. 8 hours = 28800 seconds (8 x 60 x 60). This will go into the Duration field.
However, since we can only display 1000 points in time we must set the “Sample Every” to a correct number. The basic formula for this is that “Duration” divided with “Sample Every” must not be higher than 1000. This means just that after entering the number of seconds to display, we have to divide that number with 1000 to get the lowest allowed “Sample”. In this case 28800 / 1000 = 28.8, which could be rounded up to 30. (If “Duration” / “Sample Every” is higher than 1000 an error message prevents us.)
Another example: if we want to see 24 hours in one display we first calculate the number of seconds (24 x 60 x 60) = 86400, which goes into Duration and then divide that with 1000 to get the Sample interval = 86,4 = round up to 87.
Sometimes it is very useful to both have a longer display of perhaps 8 hours to identify trends and another display with lower duration, perhaps 15 minutes, with shorter and more exact samples to identify spikes. When using a MMC and adding Perfmon as a snapin this is easy. We can only have one Duration and Sample for each Perfmon instance, but we can add several Performance Monitor into the same MMC. Just add the same counters, but set different Duration and Sample and we can switch between those depending on the need.
See the example above where the saved MMC console have several snapins with pre-configured counters for CPU available for display over both 8 hours and 15 minutes.
To get the Perfmon view more easy to read I recommend to add the grid, by going to Properties – Graph tab and select Vertical and Horizontal Grid. This adds supporting lines to increase the ability the see the actual values.
Graph Background = White
Control Background = White
Grid = Light grey
Changing the colors has obviously not any technical reason, but gives the charts a more pleasent presentation. Not the least on Windows Server 2003 which by default is very grey..
Finally, a large part of the window used for Perfmon is occupied by the so called Action Pane. This is most often not useful at all and waste space for the performance graphs. It is best to enter the View menu and deselect the Action Pane to gain more display space.
Together with adding the actual performance counters there is a lot of changes that could be done to Perfmon. However, since we will save this MMC we do not have re-enter all these settings at each startup. After configurating several different Perfmon snapins with different counters and suitable durations this will be saved to a *.MSC and could easily be available to various servers where performance analyze or troubleshooting needs to be done. This MSC file could be available on a share reachable by all servers.
The goal is to have one single MMC, complete with all different counters you need, perhaps divided into the various performances areas (cpu, disk, network, memory and other) and with suitable Duration/Sample values configured – ready to use on multiple servers.