Muokkaa

Jaa


Performance Diagnostic Tools

By Mike Rousos

This article lists tools for diagnosing performance issues in ASP.NET Core.

Visual Studio Diagnostic Tools

The profiling and diagnostic tools built into Visual Studio are a good place to start investigating performance issues. These tools are powerful and convenient to use from the Visual Studio development environment. The tooling allows analysis of CPU usage, memory usage, and performance events in ASP.NET Core apps. Being built-in makes profiling easy at development time.

More information is available in Visual Studio documentation.

Application Insights

Application Insights provides in-depth performance data for your app. Application Insights automatically collects data on response rates, failure rates, dependency response times, and more. Application Insights supports logging custom events and metrics specific to your app.

Azure Application Insights provides multiple ways to give insights on monitored apps:

  • Application Map – helps spot performance bottlenecks or failure hot-spots across all components of distributed apps.

  • Azure Metrics Explorer is a component of the Microsoft Azure portal that allows plotting charts, visually correlating trends, and investigating spikes and dips in metrics' values.

  • Performance blade in Application Insights portal:

    • Shows performance details for different operations in the monitored app.
    • Allows drilling into a single operation to check all parts/dependencies that contribute to a long duration.
    • Profiler can be invoked from here to collect performance traces on-demand.
  • Azure Application Insights Profiler allows regular and on-demand profiling of .NET apps. Azure portal shows captured performance traces with call stacks and hot paths. The trace files can also be downloaded for deeper analysis using PerfView.

Application Insights can be used in a variety of environments:

  • Optimized to work in Azure.
  • Works in production, development, and staging.
  • Works locally from Visual Studio or in other hosting environments.

For more information on code-based monitoring, see Application Insights for ASP.NET Core. For more information on codeless monitoring, see Monitor Azure App Service performance.

PerfView

PerfView is a performance analysis tool created by the .NET team specifically for diagnosing .NET performance issues. PerfView allows analysis of CPU usage, memory and GC behavior, performance events, and wall clock time.

For more about PerfView, see the user's guide available in the tool or on GitHub.

Windows Performance Toolkit

Windows Performance Toolkit (WPT) consists of two components: Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA). The tools produce in-depth performance profiles of Windows operating systems and apps. WPT has richer ways of visualizing data, but its data collecting is less powerful than PerfView's.

PerfCollect

While PerfView is a useful performance analysis tool for .NET scenarios, it only runs on Windows, so you can't use it to collect traces from ASP.NET Core apps running in Linux environments.

PerfCollect is a bash script that uses native Linux profiling tools (Perf and LTTng) to collect traces on Linux that can be analyzed by PerfView. PerfCollect is useful when performance problems show up in Linux environments where PerfView can't be used directly. Instead, PerfCollect can collect traces from .NET Core apps that are then analyzed on a Windows computer using PerfView.

More information about how to install and get started with PerfCollect is available on GitHub.

Other Third-party Performance Tools

The following lists some third-party performance tools that are useful in performance investigation of .NET Core applications.