How to setup Performance Counters to assist with CPU / Memory...

Expand / Collapse
 

How to setup Performance Counters to assist with CPU / Memory related issues



INTRODUCTION
 
Setting up performance monitors can be helpful in diagnosing resource related problems with a server and/or client machine.

The thought process was that we are mostly thinking about Processor, Memory, Disk I/O and Networking. Sometimes we want to look at the system as a whole and other times we want to look at a particular application.

Setting the performance counters up is one thing, however, more importantly, it is learning to interpret the numbers properly and figure out what they are trying to tell us.

 
Setting up a performance counter:

1.) Go to the Control Panel
2.) Click on Administrative Tools
3.) Click on Performance
4.) Right click on Counter Logs.
5.) Select New Log Settings.
6.) Enter a name for the log and click OK.
7.) Click on Add Objects.
8.) Select what type of performance object you want and click Add.
9.) Click Close.
10.) Change the Log File type to "Text File (Tab Delimited)".
11.) Click Apply and OK.


Which Performance Counters to use:

Processor

To measure processor utilization and context switching, you can use the following counters:

Counter Name Threshold Significance
Processor\% Processor Time The general figure for the threshold limit for processors is 85 percent. This counter is the primary indicator of processor activity. High values many not necessarily be bad. However, if the other processor-related counters are increasing linearly such as % Privileged Time or Processor Queue Length, high CPU utilization may be worth investigating.
Processor\% Privileged Time A figure that is consistently over 75 percent indicates a bottleneck. This counter indicates the percentage of time a thread runs in privileged mode. When your application calls operating system functions (for example to perform file or network I/O or to allocate memory), these operating system functions are executed in privileged mode.
System\Context Switches/sec As a general rule, context switching rates of less than 5,000 per second per processor are not worth worrying about. If context switching rates exceed 15,000 per second per processor, then there is a constraint. Context switching happens when a higher priority thread preempts a lower priority thread that is currently running or when a high priority thread blocks. High levels of context switching can occur when many threads share the same priority level. This often indicates that there are too many threads competing for the processors on the system. If you do not see much processor utilization and you see very low levels of context switching, it could indicate that threads are blocked.

Memory

To measure memory utilization and the impact of paging, you can use the following counters:

Counter Name Threshold Significance
Memory\Available Mbytes A consistent value of less than 20 to 25 percent of installed RAM is an indication of insufficient memory. This indicates the amount of physical memory available to processes running on the computer. Note that this counter displays the last observed value only. It is not an average.
Memory\Page Reads/sec Sustained values of more than five indicate a large number of page faults for read requests. This counter indicates that the working set of your process is too large for the physical memory and that it is paging to disk. It shows the number of read operations, without regard to the number of pages retrieved in each operation. Higher values indicate a memory bottleneck. If a low rate of page-read operations coincides with high values for Physical Disk\% Disk Time and Physical Disk\Avg. Disk Queue Length, there could be a disk bottleneck. If an increase in queue length is not accompanied by a decrease in the pages-read rate, a memory shortage exists.
Memory\Pages/sec Sustained values higher than five indicate a bottleneck. This counter indicates the rate at which pages are read from or written to disk to resolve hard page faults. Multiply the values of the Physical Disk\Avg. Disk sec/Transfer and Memory\Pages/sec counters. If the product of these counters exceeds 0.1, paging is taking more than 10 percent of disk access time, which indicates that you need more RAM.
Memory\Pool Nonpaged Bytes Watch the value of Memory\Pool Nonpaged Bytes for an increase of 10 percent or more from its value at system startup. If there is an increase of 10 percent or more from its value at startup, a serious leak is potentially developing.
Server\Pool Nonpaged Failures Regular nonzero values indicate a bottleneck. This counter indicates the number of times allocations from the nonpaged pool have failed. It indicates that the computer's physical memory is too small. The nonpaged pool contains pages from a process's virtual address space that are not to be swapped out to the page file on disk, such as a process' kernel object table. The availability of the nonpaged pool determines how many processes, threads, and other such objects can be created. When allocations from the nonpaged pool fail, this can be due to a memory leak in a process, particularly if processor usage has not increased accordingly.
Server\Pool Paged Failures No specific value. This counter indicates the number of times allocations from the paged pool have failed. This counter indicates that the computer's physical memory or page file is too small.

Disk I/O

To measure disk I/O activity, you can use the following counters: 

Counter Name Threshold Significance
PhysicalDisk\Avg. Disk sec/Read No specific value. This counter indicates the average time, in seconds, of a read of data from the disk.
PhysicalDisk\Avg. Disk sec/Transfer Should not be more than 18 milliseconds. This counter indicates the time, in seconds, of the average disk transfer. This may indicate a large amount of disk fragmentation, slow disks, or disk failures. Multiply the values of the Physical Disk\Avg. Disk sec/Transfer and Memory\Pages/sec counters. If the product of these counters exceeds 0.1, paging is taking more than 10 percent of disk access time, so you need more RAM.

Network I/O

To measure network I/O, you can use the following counters:

Counter Name Threshold Significance
Network Interface\Bytes Total/sec Sustained values of more than 80 percent of network bandwidth. This counter indicates the rate at which bytes are sent and received over each network adapter. This counter helps you know whether the traffic at your network adapter is saturated and if you need to add another network adapter. How quickly you can identify a problem depends on the type of network you have as well as whether you share bandwidth with other applications.
Network Interface\Bytes Received/sec No specific value. This counter indicates the rate at which bytes are received over each network adapter. You can calculate the rate of incoming data as a part of total bandwidth. This will help you know that you need to optimize on the incoming data from the client or that you need to add another network adapter to handle the incoming traffic.
Network Interface\Bytes Sent/sec No specific value. This counter indicates the rate at which bytes are sent over each network adapter. You can calculate the rate of incoming data as a part of total bandwidth. This will help you know that you need to optimize on the data being sent to the client or you need to add another network adapter to handle the outbound traffic.
Server\Bytes Total/sec Value should not be more than 50 percent of network capacity. This counter indicates the number of bytes sent and received over the network. Higher values indicate network bandwidth as the bottleneck. If the sum of Bytes Total/sec for all servers is roughly equal to the maximum transfer rates of your network, you may need to segment the network.

Threading and Contention

To measure threading and contention, use the following counters:

Counter Name Threshold Significance
.NET CLR LocksAndThreads\Contention Rate / sec No specific value. This counter displays the rate at which the runtime attempts to acquire a managed lock but without a success. Sustained nonzero values may be a cause of concern. You may want to run dedicated tests for a particular piece of code to identify the contention rate for the particular code path.
.NET CLR LocksAndThreads\Current Queue Length No specific value. This counter displays the last recorded number of threads currently waiting to acquire a managed lock in an application. You may want to run dedicated tests for a particular piece of code to identify the average queue length for the particular code path. This helps you identify inefficient synchronization mechanisms.
Thread\% Processor Time No specific value. This counter gives you the idea as to which thread is actually taking the maximum processor time. If you see idle CPU and low throughput, threads could be waiting or deadlocked. You can take a stack dump of the process and compare the thread IDs from test data with the dump information to identify threads that are waiting or blocked.

SQL Counters

Counter Name Threshold Significance
SQLServer: SQL Statistics: Batch Requests/Sec No specific value. Over 1000 batch requests a sec and is generally inline with how busy your CPU is.  Can be used as a pre-warning indicator if you are not experiencing an issue that it might be on its way.
SQLServer: SQL Statistics: SQL Compilations/Sec counter No specific value. Used to see if you are unnecessarily recompiling, a high number (over 100/sec), indicator of server performance.
Number of Deadlocks/sec No specific value. It takes a few deadlocks for this information to be noticeable but this would be useful if you were getting into contention issues.
SQL Server Access Methods Object: Full Scans/sec No specific value. In some cases Table Scans are ok (small datasets, data that doesn’t change much), but usually you want to see an index seek.  This would be useful for cases where they are complaining of slow DB performance so we could see if we are missing any indexes.



KEYWORDS

performance monitors counters how to setup
 


Rate this Guide:
     

No further troubleshooter steps...



Add Your Comments


Name: *
Email Address:
Web Address:
Verification Code:
*
 

Details
Last Modified:Friday, September 03, 2010
Last Modified By: ademski
Type: HOWTO
Rated 5 stars based on 1 vote
Article has been viewed 21,331 times.
Options