Monitoring Processor Activity

Applies To: Windows Server 2003, Windows Server 2003 with SP1

Several tools are available for monitoring processor performance:

  • Use the Web Capacity Analysis Tool (WCAT) to perform stress tests. For information about using WCAT, see Using WCAT as a Stress Client.

  • To monitor process performance on servers running Windows Server 2003, you can use Task Manager, System Monitor, and Performance Logs and Alerts.

Remember that all monitoring tools use system resources. Monitor the processor use of the process in which the tool runs; then, before you analyze your data, subtract the processor time of the tool process from the data.

To collect data about processor activity, monitor the counters that are listed in Table 6.19. The % Processor Time counter is the primary indicator of processor activity, displaying the average percentage of busy time observed during the sample interval.

Table 6.19 Counters for Monitoring Processor Activity

Object\Counter Value

System\Processor Queue Length

The number of threads in the processor queue. Shows ready threads only, not threads that are running. Even multiprocessor computers have a single queue for processor time; thus, for multiprocessors, you need to divide this value by the number of processors servicing the workload. A sustained processor queue of less than two threads per processor is normally acceptable, depending upon the workload.

System\Context Switches/sec

The combined rate at which all processors on the computer are switched from one thread to another.

Processor (_Total)\% Processor Time

The average percentage of time that all processors are active. This counter is the primary indicator of average processor activity. This value is derived by calculating the percentage of time during the sample interval that all processors spent in executing their idle thread (which consumes cycles on a processor when no other threads are ready to run), and then subtracting the result from 100 percent.

Processor\% Processor Time

The average percentage of processor use for each processor (#0, #1, and so on).

Processor\% Privileged Time

The average percentage of processor time that is spent in privileged mode. In Windows Server 2003, only privileged mode code has direct access to hardware and memory. Application threads can be switched to privileged mode to run operating system services.

Processor\% User Time

The average percentage of processor time that is spent in user mode. User mode is a restricted processing mode designed for applications, environment subsystems, and integral subsystems. The alternative, privileged mode, is designed for operating system components, allowing direct access to hardware and memory. The operating system switches application threads to privileged mode to access operating system services.

Process\% Processor Time

The average percentage of processor use attributable to each processor, either for a particular process or for the total for all processes (shown in the list of instances).

Tip

A memory bottleneck can sometimes look like a processor or disk bottleneck. If the system does not have enough physical memory to store the code and data that are needed, the processor spends substantial time paging. Before adding or upgrading processors or disks, you need to monitor the memory on your server. For more information about monitoring memory, see Monitoring Overall Server Memory.

Analyzing Processor Activity Data

Of the counters listed in Table 6.19, the System\Processor Queue Length counter is probably the most important for analyzing processor activity data. This counter displays the number of threads waiting to be processed in the single queue shared by all processors. Sustained high rates of processor activity, which leave little excess capacity to handle peak loads, are often associated with processor bottlenecks. Processor activity itself only indicates that the resource is being used, not that maximum use of the resource is a problem. However, a long, sustained queue indicates that threads are being kept waiting because a processor cannot handle the load assigned to it.

A sustained processor queue length of two or more threads (as indicated by the System\Processor Queue Length counter) typically indicates a processor bottleneck. You can set an alert in Performance Logs and Alerts to notify administrators when the processor queue length is unacceptably high.

The Processor\% Processor Time counter is most often used as a general measure of processor activity on both uniprocessor and multiprocessor computers. On a multiprocessor server, use this counter to reveal unequal distribution of processor load. You might have a processor bottleneck if % Processor Time numbers are high while usage of the network adapter and disk I/O remain well below capacity.

On multiprocessor computers, use the total instance of the Processor\% Processor Time counter — for example, Processor(_Total)\% Processor Time — to monitor system-wide processor use. For multiprocessor use, this counter represents the active time of all processors divided by the number of processors. If the server workload is shared equally among all processors, the total instance time is an excellent measure of processor activity.

Windows Server 2003 is designed for efficient scaling and includes several strategies for balancing processor load. An application, however, can create an imbalance by setting a processor affinity, which binds a process to a single processor. To identify processor bottlenecks related to processor affinity, chart Processor\% Processor Time for each processor on the computer.

Note

Though processor affinity can overload a single processor, it can improve performance by reducing the number of processor cache flushes as threads move from one processor to another. You will need to assess, through monitoring, whether the trade-off is acceptable. For information about assigning processor affinity to an application pool or Web garden, see Improving Processor Performance.

Optimizing Processor Activity

If data shows a large processor queue with all processors busy, view a histogram of Process\% Processor Time for each process. To do this, click the View Histogram button on the toolbar in System Monitor. The histogram shows the processor time consumed by each process.

Based on the histogram readings, consider making the following adjustments to optimize performance:

  • If a single bar in the histogram rises above all of the others, the process represented by the bar might be consuming a disproportionate share of processor time and causing a bottleneck. Consider replacing the application running in that process, or moving the process to another server.

  • If the processors are being shared equally by several processes, consider upgrading or adding processors. (Multithreaded processes benefit most from additional processors.)

For more information about processor use by applications related to IIS, see Improving Application Performance.