ASP. NET supports two sets of performance counters: system and application. The former is made public in perfmon of the ASP. NET performance counter object, and the latter is made public in ASP. NET applications performance object. ASP. the State Server sessions counters in the. NET performance object (only applicable to the server computers in which the server is running) and ASP. the sessions counters in the Net Applications performance object (only applicable to user sessions occurring in processes) differ greatly.
Note that the value associated with each performance counter is updated every 400 milliseconds.
When monitoring the performance of ASP. NET web applications, you should always keep track of the performance counters listed in the following table.
Performance object |
Performance counters |
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 |
% CPU utilization counter monitors CPU usage on the Web server computer. Regardless of the client load, low CPU usage or failure to reach the maximum CPU usage means there is a competition for resources or locks in the Web application.
In addition, when determining web application performance problems, the performance counters listed in the following table are very useful.
Performance object |
Performance counters |
ASP. NET Applications |
Pipeline instance count |
. Net CLR exceptions |
# Of exceps thrown |
System |
Context switches/sec |
# Of exceps thrown counters display the number of exceptions thrown in the application, because they may adversely affect performance. However, some code paths must depend on exceptions to work properly. For example, the httpresponse. Redirect method always raises an unrecoverable exception threadabortexception. Therefore, it is more useful to use the errors total counter to track the number of exceptions to check whether exceptions are generated on the application.
The context switches/sec counter measures the rate of context for all CPU switching threads in the web server computer. If the counter value is large, it indicates that the lock competition is fierce, or the thread switches frequently between the user and the kernel mode. You may also need to use the Sampling Analyzer and other tools for further analysis.
The following lists counters in ASP. NET and ASP. NET applications.
ASP. NET system performance counters
ASP. NET supports the following ASP. NET system performance counters. They collect information about all ASP. NET applications on the Web server computer, or they are generally applied to the systems of ASP. NET servers running the same application. They may contain web sites and web parks.
Application restarts: Number of times the application has restarted during the lifetime of the Web server. Each application_onend event occurs, the number of application restarts increases. Application restart may occur for the following reasons: Change the Web. config file, change the Assembly stored in the application/bin directory, or make too many changes to the Web table single page. An unexpected increase in this counter may mean that unknown issues will cause the web application to close. In such cases, the cause should be investigated as soon as possible.
Note that this value is reset every time you restart the Internet Information Service (IIS) host.
Application running: Number of applications running on the server computer.
Requests disconnected: Number of requests that are disconnected due to a communication failure.
Requests queued: Number of requests waiting for service in the queue. When this value increases linearly with the client load, the web server computer has reached the maximum number of concurrent requests it can process. The default maximum value of this counter is 5,000. You can change this setting in the machine. config file of your computer.
Requests rejected: Total number of unexecuted requests due to insufficient server resources. This counter indicates the number of requests that return the 503 HTTP status code (indicating that the server is too busy.
Request wait time: the number of seconds in which the most recent request in the queue is waiting for processing.
Session state server connections total: Total number of computer session state connections that store off-process session state data.
Session SQL server connections Total: Total number of session state connections of the Microsoft SQL Server database that stores session status data.
State Server sessions abandoned: number of user sessions that have been explicitly abandoned. They are Sessions terminated by a specific user, such as closing a browser or browsing to another site. This counter is only used on the computer that runs the status Server Service (aspnet_state.
State Server sessions active: Number of active user sessions. This counter is only used on the computer that runs the status Server Service (aspnet_state.
State Server sessions timed out: number of user sessions that are inactive due to user inactivity. This counter is only used on the computer that runs the status Server Service (aspnet_state.
State Server sessions Total: Number of sessions created during the lifetime of the process. This counter is the cumulative value of state Server sessions active, State Server sessions abandoned, and State Server sessions timed out. This counter is only used on the computer that runs the status Server Service (aspnet_state.
Worker process restarts: the number of times the worker process has been restarted on the server computer. If a work process fails unexpectedly or is intentionally recycled, You can restart it. When this counter increases unexpectedly, investigate the cause as soon as possible.
Worker Process running: Number of worker processes running on the server computer.
ASP. NET application performance counters
ASP. NET supports the following application performance counters, which can be used to monitor the performance of a single ASP. NET application instance. Each of these counters has a unique instance _ total __. this instance aggregates the counters of all applications on the Web server (similar to the Global counters described in Section 1 of this topic ). The _ total _ instance is always available. When no application is available on the server, these counters are displayed as zero.
Anonymous Requests: Number of requests that use anonymous authentication.
Anonymous Requests/sec: Number of requests that use Anonymous Authentication per second.
Cache total entries: Total number of items in the cache. This counter includes both the cache used internally by the ASP. NET page framework and the cache used externally through public APIs.
Cache Total hits: the total number of cache hits. This counter includes both the cache used internally by the ASP. NET page framework and the cache used externally through public APIs.
Cache Total misses: the number of cache requests failed for each application. This counter includes both the cache used internally by ASP. Net and the cache used externally through public APIs.
Cache total hit ratio: Ratio of cache hit to miss. This counter includes both the cache used internally by ASP. Net and the cache used externally through public APIs.
Cache total turnover rate: the total number of cache additions and deletions per second. This helps determine the efficiency of cache usage. The cache cannot be effectively used if the cache is large.
Cache API entries: The total number of items in the application cache.
Cache API hits: the total number of hits in the cache when the cache is accessed only through the external cache API. This counter does not track the cache used internally by ASP. NET.
Cache API misses: Total number of cache requests that fail to be accessed through the external cache API. This counter does not track the cache used internally by ASP. NET.
Cache API hit ratio: Ratio of cache hit to miss when accessed through external cache API. This counter does not track the cache used internally by ASP. NET.
Cache API turnover rate: The number of caches that increase or decrease per second when used by external APIs (excluding the cache used by the ASP. NET page framework internally. This helps determine the efficiency of cache usage. The cache cannot be effectively used if the cache is large.
Compilations Total: Total number of compilations that occur during the lifetime of the current Web server process. This happens when files or code with the extension. aspx,. asmx,. ascx, or. ashx are dynamically compiled on the server to hide the source file.
Note that when a request is made to all parts of the application, this value begins to gradually reach the peak value. However, during compilation, the generated binary data is saved to the disk (where the data is reused until the source file changes. This means that the counter can remain zero (inactive) even if the process is restarted until the application is modified or redeployed.
Debugging requests: Number of requests that occur when debugging is enabled.
Errors During preprocessing: number of errors that occur during analysis. Does not include compilation and runtime errors.
Errors During Compilation: number of errors that occur during dynamic compilation. Does not include analysis programs and runtime errors.
Errors During execution: Total number of errors that occur during HTTP request execution. Does not include analysis programs and compilation errors.
Errors unhandled during execution: Total number of unprocessed errors during HTTP request execution.
Note that unprocessed errors refer to any uncaptured runtime exceptions. They convert user code on the page and enter the internal error handling logic of ASP. NET. This rule has exceptions in the following situations:
1: Custom errors and/or error pages are enabled.
2: The page_error event is defined in the user code and the error is cleared (using the httpserverutility. clearerror method) or the redirection is executed.
Errors unhandled during execution/sec: Number of unprocessed exceptions per second during HTTP request execution.
Errors Total: Total number of errors that occur during HTTP request execution. Includes any analysis program, compilation, or runtime errors. This counter is the sum of errors during compilation, errors during preprocessing, and errors during execution counters. Normal web servers should not generate errors. If errors occur in ASP. NET web applications, they may distort the throughput results due to different error recovery code paths. Investigate and fix any errors in the application before debugging.
Errors total/sec: number of errors per second during HTTP request execution. Includes any analysis program, compilation, or runtime errors.
Output cache entries: Total number of items in the output cache.
Output cache hits: Total number of requests processed from the output cache.
Output cache misses: Number of output cache requests failed by each application.
Output cache hit ratio: Percentage of all requests processed from the output cache.
Output cache turnover rate: The number of output caches that increase or decrease per second. The cache cannot be effectively used if the cache is large.
Pipeline instance count: specifies the number of active request pipeline instances of ASP. NET applications. Because only one execution thread can be run in the pipeline instance, this value provides the maximum number of concurrent requests processed for an application. In most cases, it is best to control this value very low when there is a load, which indicates a high CPU usage.
Request bytes in total: the total size of all requests (in bytes ).
Request bytes out total: the total size of the response sent to the client (in bytes ). This does not include standard HTTP response headers.
Requests executing: number of currently executed requests.
Requests failed: Total number of failed requests. This counter is added if any or all status code is greater than or equal to 400.
Note that this counter and requests not authorized counter will be added for requests with Status Code 401. As a result, this counter and requests not found counter will be added for requests with Status Code 404 or 414. As a result, the 500 Status Code request adds this counter and the requests timed out counter.
Note that when a request is rejected (the request cannot be completed because the request is rejected by IIS rather than the process model), the equivalent ASP counter will also be added.
Requests not found: number of failed requests because no resource is found (Status Code 404, 414 ).
Requests not authorized: Number of requests failed due to no authorization (Status Code 401 ).
Requests succeeded: number of successfully executed requests (Status Code 200 ).
Requests timed out: Number of requests that have timed out (status code 500 ).
Requests Total: Total number of requests after the service is started.
Requests/sec: number of requests executed per second. It indicates the current throughput of the application. Under a constant load, this value should be within a specific range (excluding other server work, such as garbage collection, cache cleanup threads, and external server tools ).
Sessions active: Number of active sessions. This counter is only supported by the session Status in the memory.
Sessions abandoned: Number of sessions that have been explicitly abandoned. This counter is only supported by the session Status in the memory.
Sessions timed out: Number of sessions that have timed out. This counter is only supported by the session Status in the memory.
Sessions Total: Number of sessions that have timed out. This counter is only supported by the session Status in the memory.
Transactions aborted: Number of aborted transactions.
Transactions committed: number of committed transactions.
Transactions pending: number of transactions in progress.
Transactions Total: the total number of transactions after the service is started.
Transactions/sec: number of transactions started per second.