แก้ไข

แชร์ผ่าน


Profile production applications in Azure with Application Insights Profiler for .NET

Diagnosing your application's performance issues can be difficult, especially when running on a production environment in the dynamic cloud. Slow responses in your application could be caused by infrastructure, framework, or application code handling the request in the pipeline.

With Application Insights Profiler for .NET, you can capture, identify, and view performance traces for your application running in Azure, regardless of the scenario. The .NET Profiler trace process occurs automatically, at scale, and doesn't negatively affect your users. The .NET Profiler identifies:

  • The median, fastest, and slowest response times for each web request made by your customers.
  • The "hot" code path spending the most time handling a particular web request.

Enable the Profiler for .NET on all your Azure applications to gather data with the following triggers:

  • Sampling trigger: Starts Profiler randomly about once an hour for two minutes.
  • CPU trigger: Starts Profiler when the CPU usage percentage is over 80 percent.
  • Memory trigger: Starts Profiler when memory usage is above 80 percent.

Each of these triggers can be configured, enabled, or disabled.

Sampling rate and overhead

By default, Profiler actively collects traces every hour for 30 seconds or during periods of high CPU or memory usage for 30 seconds. The hourly traces (called sampling) are great for proactive tuning, while the high CPU and memory traces (called triggers) are useful for reactive troubleshooting.

Note

When Profiler is actively running and collecting traces, it typically adds between 5% to 15% of CPU and memory overhead to your server.

There is no additional cost for storing data captured by Profiler. The data is automatically deleted after 15 days.

Supported in the .NET Profiler

Profiler works with .NET applications deployed on the following Azure services. View specific instructions for enabling Profiler for each service type in the following links.

Compute platform .NET (>= 4.6) .NET Core
Azure App Service Yes Yes
Azure Virtual Machines and Virtual Machine Scale Sets for Windows Yes Yes
Azure Virtual Machines and Virtual Machine Scale Sets for Linux No Yes
Azure Cloud Services Yes Yes
Azure Container Instances for Windows No Yes
Azure Container Instances for Linux No Yes
Kubernetes No Yes
Azure Functions Yes Yes
Azure Service Fabric Yes Yes

Note

You can also use the Java Profiler for Azure Monitor Application Insights, currently in preview.

If you've enabled the Profiler for .NET but aren't seeing traces, see the Troubleshooting guide.

Limitations

  • Data retention: The default data retention period is five days.
  • Profiling web apps:
    • Although you can use the .NET Profiler at no extra cost, your web app must be hosted in the basic tier of the Web Apps feature of Azure App Service, at minimum.
    • You can attach only one profiler to each web app.
    • .NET Profiler on Linux is only supported on Windows-based web apps.

Next steps

Learn how to enable the .NET Profiler on your Azure service: