ASP.NET Counters

ASP.NET Counters

Strategy for Monitoring ASP.NET Performance

  • Log Performance Counter Objects  for sets of counters that contain critical counters
  • Set logging interval to 15 minutes
  • Log data over multiple weeks
  • Use Performance Monitor to display logged data for critical counters as detailed below

Steps for Monitoring ASP.NET Performance

  • Run the Performance Monitor application
  • Right-click Performance > Data Collector Sets > User Defined
  • Select New > Data Collector Set
  • Type ASP.NET Performance and click Create Manually (Advanced)
  • Click Create Data Logs > Performance Counter and then click Next
  • Add the following Performance Counter Objects
    • .NET CLR Exceptions
    • .NET CLR Memory
    • ASP.NET
    • ASP.NET Applications
  • Set interval for 15 minutes and Click Finish 

.NET CLR Exceptions Counters

  • # of Exceps Thrown displays the number of exceptions thrown in the app
  • The Redirect method on the Response object and other code paths rely on exceptions
  • Track Errors Total for the application to see if the exception generated an error on the app

.NET CLR Memory Counters

  • # Bytes in all Heaps displays the current memory allocated to all of the Garbage Collector Heaps
    • Gen 0 Heap Size
    • Gen 1 Heap Size
    • Gen 2 Heap Size
    • Large Object Heap Size
  • # Induced GC displays the number of times the Garbage Collector is being called
    • A high value often indicates a bug in the application code
    • Remove calls to GC.Collect in the application code
    • Remove calls to GC.GetTotalMemory with true in the application code
  • # Total committed Bytes displays the amount of virtual memory currently committed by the Garbage Collector
  • # Total reserved Bytes displays the amount of virtual memory currently reserved by the Garbage Collector
  • % Time in GC displays the time spent in the Garbage Collector since the end of the last cycle
    • Investigate the managed heap if the value is 50% or higher

ASP.NET Object Counters

  • Application Restarts displays the number of times that an app has been restarted during the server's lifetime
    • Changes to assemblies, the Web.config file, or numerous changes in ASP.NET Web pages
    • High number can mean that problems are causing your Web application to recycle
  • Requests Queued displays 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 of 5,000 can be changed in the Machine.config file
  • Worker Process Restarts displays the number of times a worker process has been restarted on the server
    • Unexpected failures
    • Intentional recycles

ASP.NET Applications Object Counters

  • Errors Total displays the total number of errors that occur during the execution of HTTP requests
    • Includes Errors During Preprocessing, which indicates parser errors
    • Includes Errors During Compilation, which indicates compilation errors
    • Includes Errors During Execution, which indicates run-time errors
  • Pipeline Instance Count displays the maximum number of concurrent requests that are being processed for the app
    • A low number when the app is under load signifies that the CPU is well utilized
  • Requests/sec displays the current throughput of the application
    • Under constant load, this number should remain within a certain range