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.
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.
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.
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.
Symptom: The web app always encountered slow response issue when going to /repro page. It took about 21 seconds to open this page.
Go to Azure App Service portal -> Settings -> Application Insights -> View Application Insights data -> Select "Server response time", Select the correct time scope.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.