We are excited to announce the general availabilty of Application Insights Profiler for Azure App Service. At the same time, we are pleased to introduce the Public Preview version of the Profiler for compute resources, e.g. Virtual Machines, scale sets, Cloud Services, and Service Fabric. The Profiler allows you to automatically collect and view code level traces for slow requests in your production application.
Overview
It is hard to diagnose performance issues, especially when the app is running on production environment in the cloud . If your customers are experiencing slow responses when using your app, it could be caused by any infrastructure, framework or application code that are in the pipeline for handling the request. The cloud is very dynamic – with machines coming and going, with user input and other conditions constantly changing, and with the possibility of high scale.
Application Insights Profiler solves the exact problem above: it enables you to capture and view performance traces for your application in all these dynamic situations, and it happens automatically at scale without negatively affecting your end users. Application Insights Profiler captures the following information so you can easily identify performance issues when your app is running in Azure:
- The median, fastest and slowest response times for each web request made by your customers
- The “hot” code path that takes the longest time when handling a particular web request
The Profiler builds on the PerfView tool for diagnosing performance issues that you might be familiar with. It is optimized to run PerfView algorithms at scale, taking low overhead examples for a short period of each hour. We recommend you use it on all your Azure applications to identify performance issues as early as possible. In fact, our goal is to help you make sure your Azure application doesn’t have any performance issues – enabling the Profiler can catch the issues early and prevent your customers from being widely impacted.
Enabling the Profiler
To enable Application Insights Profiler on App Services:
Profiling live Azure web apps with Application Insights
To enable Application Insights Profiler (preview) on Compute resources:
Enable Profiler for other Azure compute services
Viewing Results
Here is a quick tour to demonstrate how you can easily identify performance issues in your application. Suppose you have a Music Store web application that allows customers to purchase music albums online. You deployed your app on Azure and enabled Application Insights Profiler on it. The profiler will help you to make sure your application is performant all the time.
Discover Performance Issues
Start with navigating to the Application Insights resource Music Store that web app uses. Open the Performance blade to see an overview of performance statistics.
The new operations section on the left side of performance blade shows a summary for how long each web request takes. You can click on a particular row to filter content on the right side. By default, all requests are selected.
The Overall section on the right side illustrates a distribution for how many requests are taking longer than usual, or within the average range, grouped by percentiles. You can use the slider bar to filter the duration time range to drill into details of these requests.
On the bottom right corner, there are a few actions you can take. In this case, we want to investigate why a particular request is slow, so click on the Profiler Traces button.
You sorted the 95th percentile times to learn which calls have the slowest response times. You noticed that the ShoppingCart related requests could be really slow in the worst cases. ShoppingCart is where customers checkout and proceed with payment. You should make sure this important feature works responsively and reliably all the time. So you want to learn more about what happened.
Identify root causes to the performance issues
You get to the detailed profile traces by clicking on the Examples column icon on the row for POST ShoppingCart/RemoveFromCart method, which has the slowest worst case response times. This opens the detailed trace view blade as illustrated below.
Select a sample in the 95th percentile Example bucket. Clicking “Show Hot Path” on the Trace view will automatically expand the tree to show the call stack where most of the time was spent. Often times this takes you right to the call(s) that need intervention to improve performance.
In this example the hot path for our Remove from Cart operation of the Music Store is spending too much in lock contention. The Profiler identifies this immediately and points you to guidance on addressing lock contention. This is one of many examples that the profiler can help you with. Others include slower algorithms/functions, blocked time on external calls, data calls in need of caching, lock contention, and more.
Pricing and Limitations
We’re pleased to announce that profiling data is included with Application Insights with 5 days of retention at no extra charge.
- The maximum ingested data per day is 10 GB.
- Your web app must be hosted in at least the Basic tier of App Services.
Wrapping Up
We’re excited for the general availability of the Application Insights Profiler to help you to better diagnose and fix performance issues in your production applications.
Try it out today! Let us know what you think by sending email to serviceprofilerhelp@microsoft.com, or leaving comments here on this post!