This article reviews tools and methods to collect information to use for troubleshooting a Sitecore XP application on Azure Web Apps.
The following sections describe ways to gather relevant data for typical performance issues, such as:
- High CPU usage.
- Memory leaks.
- Long response time and other types of slowness.
Microsoft Azure Web Apps (App Service) comes with the KUDU toolset enabling extended low-level diagnostics access for troubleshooting web applications.
To run KUDU for your Sitecore XP application deployed to Azure Web Apps, use the following URL:
https://<name-of-AzureWebApp>.scm.azurewebsites.net/
Note: You must be logged in to the Azure Portal and have access to a particular Resource Group as a Contributor.
Azure App Service instances include the Sysinternals suite in the default image. They can be located at this path via the KUDU console: D:\devtools\sysinternals.
It is also possible to download the ProcDump tool from here, upload it to a specific location such as D:\home\Dumps and use it.
To collect a memory dump:
- Open KUDU and go to the Process Explorer.
- Note the PID (Process ID) of the w3wp.exe process corresponding to the application.
- Go to Debug Console -> CMD.
- In the command window, navigate to the dumps folder.
- Execute the following command to generate a full memory dump of the process:
procdump.exe -accepteula -ma [PID of the process]
-ma — write a dump file with whole process memory.
-accepteula — automatically accept the Sysinternals license agreement.
Note: When the manual memory dump collection is not appropriate, the Procdump utility provides the ability to specify different conditions for when to automatically collect a memory dump. For more information on this topic, please refer to the following article: How to collect memory dumps using ProcDump.
To collect a memory dump:
- Open KUDU and go to the Process Explorer.
- For the w3wp.exe process (not SCM), right-click to access the context menu.
- In the context menu, click Download Memory Dump -> Full Dump:
A *.dmp file is downloaded. You can analyze it using a common tool, such as WinDbg.
Note: To ensure that the memory dump is analyzed properly, you must have the SOS.dll file from the target OS.
To get the SOS.dll file:
- Open KUDU and go to Debug console -> CMD.
- Navigate to the system drive using the button at the top.
- Locate the SOS.dll file in an appropriate .NET Framework folder (for example, C:\Windows\Microsoft.NET\Framework64\v4.0.30319).
- Download the SOS.dll file.
To collect a memory dump via the Azure portal:
- Login to the Azure portal (https://portal.azure.com).
- Select the Azure Web App that you need to troubleshoot.
- Click Diagnose and solve problems and then click Diagnostics as a Service:
- In the new blade, set the following fields:
- Application Type – set the value to ASP.NET.
- Diagnosers – select the Memory Dump check box. If you want Event Viewer Logs and Http Logs, you can select these check boxes too.
- Instances – if the App Service Plan is configured to use more than one instance, you can configure this field to collect the logs on either all instances or specific instances.
- To collect the logs, click Run . The blade indicates the status of the operation and runs analysis on the collected data. The data is saved under the D:\home\data\DaaS\Logs folder.
To collect a performance profile:
- Open KUDU and go to the Process explorer section.
- For the w3wp.exe process (not SCM), check the "Collect IIS Events" checkbox and click Start Profiling.
- Request your web application home page and, to ensure that profiling is running, click Refresh on the KUDU page.
- Reproduce the performance issue in your web application.
- Go back to the Process explorer section in KUDU.
- Click Stop Profiling.
After the process is finished, a profile_*_w3wp_*.diagsession file is downloaded to your PC.
To further analyze the downloaded file, open it in Microsoft Visual Studio: