How to use Red Gate's ANTs profiler to troubleshoot performance issues

  • Updated

This article provides a better understanding of how to use Red Gate's ANTs Performance Profiler to troubleshoot performance issues.

For demonstration purposes, an Ektron OnTrek site is profiled in the Visual Studio Web Development Server. To set up ANTS Performance Profiler:

  1. In the ANTS Performance Profiler start screen, select New profiling session then open the Web dev. Server - ASP.NET tab.
  2. In ASP.NET web application (path), browse to the site's root folder.
  3. Choose the required profiling mode. Here, use line-level and method-level timings for methods with source only.

    Antz1
  4. Click Start profiling to begin.                                                                                StartProfiling
  5. The default browser (chosen on the setup page) loads the selected site.

    ANTz2

 

While using the OnTrek site, ANTS Performance Profiler's timeline shows the CPU usage the application has caused.

ANTz3

You can expect a CPU peak when the site launches. The CPU then returns to near zero until a search term is entered. After the term is entered, the CPU begins to grow, staying high for about 8 seconds. If there is a performance issue, the CPU may spike to nearly 100%, which clearly indicates a performance bottleneck in the search feature.

Analyzing the profiler's results

  1. Click and drag on the profiler's timeline to select the region of time where CPU usage was high. After a few moments, full results are shown. ANTz4
  2. At the top of the call tree, ANTS Performance Profiler shows the "hottest" stack trace, that is, the code that results in the greatest proportion of CPU time. Ideally, this is a good place to start fine tuning or optimizing the code.

For more information on hot stacks and HTTP nodes, see ANTs Profiler's documentation on Working with the call tree.

Using the Profiler to analyze code

For testing purposes, a code sample was created using the content manager get list to show how to analyze API calls.

  1. Here, the Profiler loaded the test template and monitored the steps until the page completely loaded.

    antz6
  2. From this screen, you can step into the template to find the method qualifying as the most expensive stack trace and make adjustments.
    ANTZ9
  3. Here, you can navigate to the template/code method in question. Additional data on CPU usage, duration and hit counts are recorded for a more accurate reading. 

 For more on source code view, see ANTs Profiler's documentation on Working with source code