Windows Server 2003 Performance Tuning
A Crash Course in Performance Monitoring
The tool of choice for diagnosing the cause of a server’s performance is the Performance Monitor. You can access the Performance Monitor by either selecting it from Windows’ Administrative Tools menu or by entering the PERFMON.MSC command at the Run prompt.
Lesson number one regarding the Performance Monitor is that the information that Performance Monitor reports to you is never going to be completely accurate. The reason is because Performance Monitor is a running process. Like any other process, the Performance Monitor consumes things like processor cycles, memory, and possibly hard disk resources. Therefore, the amount of available system resources reported by performance monitor is slightly lower than what is actually available when Performance Monitor is not running. Even so, Performance Monitor is accurate enough that it can be used to help you to determine the root cause of performance related issues.
Some people claim that your results are more accurate if you run Performance Monitor on a different machine than the one that you are monitoring. Even running Performance Monitor remotely consumes some resources on the machine that you are monitoring.
When the Performance Monitor opens, you will see a screen similar to the one that’s shown in Figure A. As you can see in the figure, the Performance Monitor displays system performance graphically. When you open Performance Monitor it is configured by default to monitor certain aspects of the system’s performance. I recommend disabling all of the default measurements so that you can start with a clean slate. To do so, select the counters at the bottom of the screen one at a time and then click the icon that resembles the letter X. You will now see a screen resembling the one shown in Figure B.
Figure A: This is the default Performance Monitor screen
Figure B: This is what Performance Monitor looks like after you clear the default measurements
Now it’s time to begin selecting the aspects of the system’s performance that you want to monitor. To do so, click the icon that looks like a plus sign. When you do, you will see the Add Counters dialog box, shown in Figure C.
Figure C: The Add Counters dialog box allows you to choose what aspects of the system’s performance you want to monitor
The Add Counters dialog box is divided into several different areas. The area at the top allows you to select which computer you want to monitor. By default the local system should be selected. Just below the system being monitored is the Performance Objects drop down list. Performance Objects are nothing more than generic classifications. For example, you will notice that the Processor performance object is selected in Figure C. This means that all of the choices on the Counters list below will pertain to measuring the performance of the processor. There are also performance objects related to things like the system’s memory, hard disk, and network connection.
The counters themselves are what actually measure system performance. For example, you will notice that in the figure, the % Processor Time counter is selected. This counter tells you what percentage of the available CPU cycles are being consumed. For instance if the % Processor Time counter reads 70, then the CPU is working at 70% capacity.
This is a good time to mention that it is usually more important to look at averages rather than actual values. Suppose for example that you opened up a new application and the % Processor Time counter shot up to 100%. This means that the CPU is running at maximum capacity. This does not however mean that the CPU is inadequate for the load being placed on it. It simply means that there was a brief spike in activity that pushed the processor to 100% utilization. Spikes are perfectly normal. As long as the average CPU utilization stays below about 80% then everything is OK.
Another thing that I want to talk about in regards to the Add Counters dialog box is the Instance section. In this particular case, the instance doesn’t really mean much. If I were monitoring a multi-processor server though, the instance section would allow me to choose which processor I wanted to monitor.
Now that I have given you a crash course in using the Performance Monitor, it’s time to start diagnosing the system’s performance. Before we get started, I just want to mention that there are hundreds of counters built into Windows. There is no way that I have the space to talk about all of them. Instead I will just focus on some of the more important ones. If you’d like to know more about a counter that I haven’t covered, simply select the counter and click the Explain button.
Disk Related Counters
If you suspect that your system’s hard disk might be a bottleneck for the system, then there are two counters that you should examine within the Physical Disk performance object. The counters are % Disk Time and Current Disk Queue Length.
The % Disk Time counter works very similarly to the % Processor Time counter that I talked about earlier. It shows you what percentage of the time the hard disk is busy. You want this counter’s average value to be as low as possible (but not zero). An average value of 90% or above indicates that the hard disk can’t keep up with the demand. This could be due to a hard disk that is too slow, or it could be caused by excessive paging. I will talk more about paging in the section on memory.
The Current Disk Queue Length counter tells you how many I/O operations are waiting for the hard disk to become available. Again, this number should be as low as possible. Experts give differing opinions of what is an acceptable value, but my opinion is that the average disk queue length should be three or less.
Memory Related Counters
There are a number of counters in the memory category that you can use to spot poor performance that may be caused by insufficient RAM. Here are some of those counters:
PAGES/SEC – this value counts the number of times per second that the computer must access virtual memory rather than physical memory. A value above 20 is considered to be problematic, but it may indicate a problem with the way that your virtual memory is configured rather than a problem with the physical memory.
Committed Bytes and Available Bytes – The Committed Bytes counter traces the amount of virtual memory that’s in use. The Available Bytes counter monitors how much memory is actually available. As you might expect, as the Available Bytes counter decreases, paging increases, thus slowing down your machine. If you determine that the Available Bytes are often in short supply, you can correct the problem by adding memory. However, before you do, try watching both counters together as you open and close programs. If the committed bytes don’t decrease and available bytes don’t increase as you close programs, the system may have a memory leak which is caused by a software problem rather than insufficient RAM.
Pool Nonpaged Bytes and Pool Nonpaged Allocs – Another way to test for memory leaks is to watch these two counters. The Pool Nonpaged Bytes counter counts pages of memory that can’t be moved to virtual memory, but must stay in the physical RAM. Normally, if this value is too high, you’ll have to add more memory. However, you can watch the Pool Nonpaged Allocs counter to see just how many calls are being made to that portion of the memory. If the number of calls don’t seem to correspond with the number of memory pages, you may have a memory leak rather than insufficient memory.
Cache Bytes – This counter monitors the amount of memory being used for the file system cache. Anything over 4 MB is considered to be to much. The solution is to add more memory.
In this article, I have explained that the Performance Monitor is the tool of choice for monitoring your system’s performance. I then went on to discuss some of the more important Performance Monitor counters.