Diagnose App Service Web Apps' Performance Issues And Failing Issues Using Application Insights
Published May 14 2022 11:25 PM 2,163 Views
Microsoft

After setup web app on Azure App Service, some customers might experience high response time, slowness, timeout etc performance issues or HTTP 500 internal server error issues with their app occasionally. Most HTTP 500 internal server error issues are likely to be caused by the unhandled exceptions thrown out by the application code. Besides monitoring the resources usage(CPU, memory, TCP connections etc) for the app service plan using "Metrics" under "Monitoring" from the Azure App Service portal, customers can further troubleshoot and diagnose these kinds of issues with Application Insights.

 

Application Insights is an important and powerful tool for diagnosing Azure App Service web apps' performance issues and requests failing issues. You can find it from Azure App Service portal-> Settings-> Application Insights.

You need to enable Application Insights from here on the portal to enable the Application Insights Codeless Agent.  After replicating the performance issue or request failing issue, you can view the AI data also from here by clicking

"View Application Insights data ->".

 

Here are 2 examples for how to use Application Insights to drill into the slowness or failing issues.

 

  • Request Failing Issue

 Symptom: The deployed website is throwing an error when users browse to its /repro page.

 Troubleshooting: Go to Azure App Service portal -> Settings -> Application Insights -> View Application Insights data -> Select "Failed requests", Select the correct time scope.

 

Weizhen_Sun_0-1652002160788.png

 

Find the specific failed request within your replication time period, by selecting the correct URI, then clicking "Drill Into XX Samples" or clicking the "Count" number directly.

 

Weizhen_Sun_1-1652002160794.png

 

In this case, after viewing the request's details, we found that

When browsing to the /repro page of this web site, this web app made a remote call to https://j*****500.azurewebsites.net/ by a GET request, but got a 500 return code from that app, then it threw out an unhandled exception System.Net.Http.HttpRequestException. That was why user got HTTP 500 status code upon browsing to the /repro page.

 

Weizhen_Sun_2-1652002160799.png

 

Weizhen_Sun_3-1652002160803.png

 

  • Slowness Issue

Symptom: The web app always encountered slow response issue when going to /repro page. It took about 21 seconds to open this page.

Troubleshooting:

Go to Azure App Service portal -> Settings -> Application Insights -> View Application Insights data -> Select "Server response time", Select the correct time scope.

 

Weizhen_Sun_4-1652002160807.png

 

In this case, after viewing this request's details, we found when browsing to the /repro page of this web site, it made a remote call to another site, and that site took almost 21 seconds to respond.

That was why user always needed about 21 seconds to open the /repro page of this web site.

 

Weizhen_Sun_5-1652002160810.png

 

More Information 

Another powerful feature of Application Insights is the App Insights Profiler. Profiler helps you identify the “hot” code paths that take the longest when handling a web request. For how to enable Application Insights Profiler, refer to Profile live Azure App Service apps with Application Insights - Azure Monitor | Microsoft Docs.

Co-Authors
Version history
Last update:
‎May 14 2022 11:20 PM
Updated by: