Performance Counters for ASP.NET
ASP.NET supports two groups of performance counters: system and application. System performance counters are exposed in the Windows Performance monitor as the ASP.NET performance counter object. Application performance counters are exposed as the ASP.NET Applications performance object.
Note
The value associated with each performance counter is updated every 400 milliseconds. When creating a monitoring application, be sure to take this time lapse into account so that your code does not use an obsolete counter value. For more information, see Using System Monitoring Components.
For additional information on system and application performance counters, see How to: Create Performance Counter Categories, Category and Counter Management and How to: Create Custom Performance Counters.
When monitoring the performance of your ASP.NET Web applications, you can track the performance counters listed in the following table.
Performance object |
Performance counter |
---|---|
ASP.NET |
Application Restarts |
ASP.NET |
Requests Queued |
ASP.NET |
Worker Process Restarts |
ASP.NET Applications |
Errors Total |
ASP.NET Applications |
Requests/Sec |
Processor |
% CPU Utilization
Note:
Low CPU utilization or the inability to maximize CPU utilization regardless of client load can signify contention for a lock or a resource in your Web application.
|
In addition, the following performance counters can be valuable in determining problems with your Web applications' performance.
Performance object |
Performance counter |
---|---|
ASP.NET Applications |
Pipeline Instance Count |
.NET CLR Exceptions |
# of Exceps Thrown |
System |
Context Switches/sec |
The # of Exceps Thrown counter displays the number of exceptions thrown in an application, because these can have performance implications. However, some code paths rely on exceptions for proper functioning. For example, the Redirect method on the Response object throws the ThreadAbortException exception, which cannot be caught. Therefore, it can be useful to track this value along with the Errors Total counter to see if the exception generated an error on the application.
The Context Switches/sec counter measures the rate at which thread contexts are switched by all CPUs in the Web server computer. A high number for this counter usually indicates either high contention in locks or many switches by the thread between user and kernel modes. If you experience this, you should investigate further with sampling profilers and other tools.
ASP.NET System Performance Counters
ASP.NET supports the ASP.NET system performance counters listed in the following table. These counters aggregate information from all ASP.NET applications on a Web server computer.
Note
There is a significant difference between the State Server Sessions counters found in the ASP.NET performance object, which apply only to the server computer on which the state server is running, and the Sessions counters found in the ASP.NET Applications performance object, which apply only to user sessions that occur in-process.
Application Restarts
The number of times that an application has been restarted during the Web server's lifetime. Application restarts are incremented each time an Application_OnEnd event is raised. An application restart can occur because of changes to the Web.config file, changes to assemblies stored in the application's Bin directory, or when an application must be recompiled due to numerous changes in ASP.NET Web pages. Unexpected increases in this counter can mean that problems are causing your Web application to recycle. In such circumstances you should investigate as soon as possible.Note
This value is reset to zero every time the Internet Information Services (IIS) host is restarted.
Application Running
The number of applications running concurrently on the server computer.Requests Disconnected
The number of requests that have been disconnected due to a communication failure.Requests Queued
The number of requests waiting for service from the queue. When this number starts to increment linearly with increased client load, the Web server computer has reached the limit of concurrent requests that it can process. The default maximum for this counter is 5,000. You can change this setting in the Machine.config file.Requests Rejected
The total number of requests not executed because of insufficient server resources to process them. This counter represents the number of requests that return a 503 HTTP status code, indicating that the server is too busy.Request Wait Time
The number of milliseconds that the most recent request waited in the queue for processing.Session State Server Connections Total
The total number of session-state connections made to the computer on which out-of-process session-state data is stored. For more information, see Session-State Modes.Session SQL Server Connections Total
The total number of session-state connections made to the Microsoft SQL Server database in which session-state data is stored. For more information, see Session-State Modes.State Server Sessions Abandoned
The number of user sessions that have been explicitly abandoned. These are sessions that are ended by specific user actions, such as closing the browser or navigating to another site. This counter is available only on the computer where the state server service (aspnet_state) is running.State Server Sessions Active
The number of currently active user sessions. This counter is available only on the computer where the state server service (aspnet_state) is running.State Server Sessions Timed Out
The number of user sessions that have become inactive through user inaction. This counter is available only on the computer where the state server service (aspnet_state) is running.State Server Sessions Total
The number of sessions created during the lifetime of the process. This counter is the total value of State Server Sessions Active, State Server Sessions Abandoned, and State Server Sessions Timed Out. This counter is available only on the computer where the state server service (aspnet_state) is running.Worker Process Restarts
The number of times a worker process has been restarted on the server computer. A worker process can be restarted if it fails unexpectedly or when it is intentionally recycled. If this counter increases unexpectedly, you should investigate as soon as possible.Worker Process Running
The number of worker processes running on the server computer.
ASP.NET Application Performance Counters
ASP.NET supports the application performance counters listed in the following table. These counters enable you to monitor the performance of a single instance of an ASP.NET application. A unique instance named __Total__ is available for these counters. This instance aggregates counters for all applications on a Web server (similar to the global counters described earlier in this topic). The __Total__ instance is always available. The counters will display zero when no applications are currently executing on the server.
Anonymous Requests
The number of requests that are using anonymous authentication.Anonymous Requests/Sec
The number of requests per second that are using anonymous authentication.Cache Total Entries
The total number of entries in the cache. This counter includes both use of the cache by the ASP.NET page framework and use of the application cache through cache APIs.Cache Total Hits
The total number of hits from the cache. This counter includes both use of the cache by the ASP.NET page framework and use of the application cache through cache APIs.Cache Total Misses
The number of failed cache requests per application. This counter includes both use of the cache by the ASP.NET page framework and use of the application cache through cache APIs.Cache Total Hit Ratio
The ratio of hits to misses for the cache. This counter includes both use of the cache by the ASP.NET page framework NET and use of the application cache through cache APIs.Cache Total Turnover Rate
The number of additions and removals to the cache per second, which is useful in helping to determine how effectively the cache is being used. If the turnover rate is high, the cache is not being used efficiently.Cache API Entries
The total number of entries in the application cache.Cache API Hits
The total number of hits from the cache when it is accessed only through the external cache APIs. This counter does not track use of the cache by the ASP.NET page framework.Cache API Misses
The total number of failed requests to the cache when accessed through the external cache APIs. This counter does not track use of the cache by the ASP.NET page framework.Cache API Hit Ratio
The cache hit-to-miss ratio when accessed through the external cache APIs. This counter does not track use of the cache by the ASP.NET page framework.Cache API Turnover Rate
The number of additions and removals to the cache per second when used through the external APIs (excluding use by the ASP.NET page framework). It is useful in helping determine how effectively the cache is being used. If the turnover rate is high, then the cache is not being used effectively.Compilations Total
The total number of compilations that have taken place during the lifetime of the current Web server process. Compilation occurs when a file with an .aspx, .asmx, .ascx, or .ashx file name extension, or a code-behind source file, is dynamically compiled on the server.This number will initially climb to a peak value as requests are made to all parts of an application. Once compilation occurs, however, the resulting compiled output is saved to disk, where it is reused until its source file changes. This means that even in the event of a process restart the counter can remain at zero (inactive) until the application is modified or redeployed.
Debugging Requests
The number of requests that occur while debugging is enabled.Errors During Preprocessing
The number of errors that occurred during parsing, excluding compilation and run-time errors.Errors During Compilation
The number of errors that occur during dynamic compilation, excluding parser and run-time errors.Errors During Execution
The total number of errors that occur during the execution of an HTTP request, excluding parser and compilation errors.Errors Unhandled During Execution
The total number of unhandled errors that occur during the execution of HTTP requests. An unhandled error is any run-time exception that is not trapped in user code and enters the ASP.NET internal error-handling logic. Exceptions to this rule occur when:Custom errors are enabled, an error page is defined, or both.
The Page_Error event is defined in user code and either the error is cleared (using the ClearError method) or a redirect is performed.
Errors Unhandled During Execution/Sec
The number of unhandled exceptions per second that occur during the execution of HTTP requests.Errors Total
The total number of errors that occur during the execution of HTTP requests, including any parser, compilation, or run-time errors. This counter is the sum of the Errors During Compilation, Errors During Preprocessing, and Errors During Execution counters. A well-functioning Web server should not generate errors. If errors occur in your ASP.NET Web application, they may skew any throughput results because of very different code paths for error recovery. Investigate and fix any bugs in your application before performance testing.Errors Total/Sec
The number of errors per second that occur during the execution of HTTP requests, including any parser, compilation, or run-time errors.Output Cache Entries
The total number of entries in the output cache.Output Cache Hits
The total number of requests serviced from the output cache.Output Cache Misses
The number of failed output-cache requests per application.Output Cache Hit Ratio
The percentage of total requests serviced from the output cache.Output Cache Turnover Rate
The number of additions and removals to the output cache per second. If the turnover rate is high, the cache is not being used effectively.Pipeline Instance Count
The number of active request pipeline instances for the specified ASP.NET application. Since only one execution thread can run within a pipeline instance, this number gives the maximum number of concurrent requests that are being processed for a given application. In most circumstances it is better for this number to be low when under load, which signifies that the CPU is well utilized.Request Bytes In Total
The total size in bytes of all requests.Request Bytes Out Total
The total size in bytes of responses sent to a client. This does not include HTTP response headers.Requests Executing
The number of requests currently executing.Requests Failed
The total number of failed requests. Any status codes greater than or equal to 400 will increment this counter.Requests that cause a 401 status code increment this counter and the Requests Not Authorized counter. Requests that cause a 404 or 414 status code increment this counter and the Requests Not Found counter. Requests that cause a 500 status code increment this counter and the Requests Timed Out counter.
Requests Not Found
The number of requests that failed because resources were not found (status code 404 or 414).Requests Not Authorized
The number of requests that failed due to no authorization (status code 401).Requests Succeeded
The number of requests that executed successfully (status code 200).Requests Timed Out
The number of requests that timed out (status code 500).Requests Total
The total number of requests since the service was started.Requests/Sec
The number of requests executed per second. This represents the current throughput of the application. Under constant load, this number should remain within a certain range, barring other server work (such as garbage collection, cache cleanup thread, external server tools, and so on).Sessions Active
The number of sessions currently active. This counter is supported only with in-memory session state.Sessions Abandoned
The number of sessions that have been explicitly abandoned. This counter is supported only with in-memory session state.Sessions Timed Out
The number of sessions that timed out. This counter is supported only with in-memory session state.Sessions Total
The total number of sessions. This counter is supported only with in-memory session state.Transactions Aborted
The number of COM+ transactions canceled for all active ASP.NET applications.Transactions Committed
The number of COM+ transactions committed for all active ASP.NET applications.Transactions Pending
The number of COM+ transactions in progress for all active ASP.NET applications.Transactions Total
The total number of COM+ transactions for all active ASP.NET applications.Transactions/Sec
The number of COM+ transactions started per second for all active ASP.NET applications.
See Also
Concepts
Performance Issues when Migrating from ASP to ASP.NET
Monitoring ASP.NET Application Performance