Memory Dump in Azure for Troubleshooting Azure App Services

Author

Reads 1.2K

View of Burning Piles of Waste
Credit: pexels.com, View of Burning Piles of Waste

Troubleshooting Azure App Services can be a daunting task, especially when it comes to memory-related issues. Memory dumps can provide valuable insights into what's going on.

Azure provides a feature called Memory Dump in Azure for Troubleshooting Azure App Services, which allows you to collect and analyze memory dumps from your App Service instances. This feature is available for both Linux and Windows App Services.

A memory dump is essentially a snapshot of a process's memory at a specific point in time. It's like taking a photo of a crime scene to investigate what happened.

Auto-Heal and Monitoring

Auto-Heal and Monitoring is a powerful combination for troubleshooting issues in Azure. The auto-heal (request duration) feature captures a memory dump if the response is taking longer than expected to finish. It's useful for situations where the issue is currently occurring or reproducible.

You can configure this feature by setting the CPU Threshold, Threshold Seconds, and Monitor Frequency in the Proactive CPU Monitoring page. For example, if there's 75-percent CPU usage for a total of 30 seconds, the memory dump would be captured.

Take a look at this: Nextcloud Memory

Credit: youtube.com, Get Memory Dump in Azure App Service

The auto-heal (memory limit) feature is useful for capturing a memory dump if the process is consuming more memory than expected. You can enter a memory value that triggers the capture of a memory dump when that memory limit is breached, such as 6 GB of memory consumed.

Here are the data monitoring categories for CPU usage:

  • CPU Threshold: identifies how much computer CPU the targeted process uses (W3WP in this case)
  • Threshold Seconds: the amount of time that the CPU was used at the CPU Threshold
  • Monitor Frequency: the frequency at which the process is checked for threshold breaches

Auto-Heal

The auto-heal feature can be accessed through the Diagnostic Tools tile, which is available on the Diagnostic Tools page. There are two types of auto-heal features: request duration and memory limit.

Request duration auto-heal captures a memory dump when the response is taking longer than expected to finish. This feature is useful for diagnosing issues related to slow response times.

Memory limit auto-heal captures a memory dump when the process is consuming more memory than expected. You can enter a memory value that triggers the capture of a memory dump when that memory limit is breached.

Readers also liked: Dump Nmi Azure

Bright cumulus clouds against a clear blue sky, perfect for backgrounds or wallpaper.
Credit: pexels.com, Bright cumulus clouds against a clear blue sky, perfect for backgrounds or wallpaper.

To configure the memory limit auto-heal feature, select the Memory Limit tile and enter a value, such as 6291456, which corresponds to 6 GB of memory. A memory dump of the W3WP process will be taken when 6 GB of memory is consumed.

The Collect a Memory dump feature is useful in scenarios where the issue is currently occurring or reproducible. This feature quickly collects a memory dump on manual demand.

Here are some key features of the auto-heal feature:

  • Request duration auto-heal captures a memory dump when the response is taking longer than expected to finish.
  • Memory limit auto-heal captures a memory dump when the process is consuming more memory than expected.
  • You can enter a memory value that triggers the capture of a memory dump when that memory limit is breached.
  • The Collect a Memory dump feature quickly collects a memory dump on manual demand.

Proactive CPU Monitoring

Proactive CPU Monitoring is a powerful feature that helps you catch potential issues before they become major problems. It monitors your CPU usage in real-time, alerting you to critical situations that require immediate investigation.

You should consider CPU usage of 80 percent or more as a critical situation that requires immediate investigation. This is because high CPU usage can lead to slow performance, crashes, and other issues.

The Proactive CPU Monitoring page allows you to set the scenario for capturing a memory dump based on CPU usage and other factors. You can configure the CPU Threshold, Threshold Seconds, and Monitor Frequency to suit your needs.

Credit: youtube.com, How to identify and diagnose apps with high CPU: Part 2 | Azure App Service

The CPU Threshold identifies how much computer CPU the targeted process uses. For example, if the W3WP process is using 75 percent of the CPU, a memory dump would be captured if the usage persists for 30 seconds.

The Threshold Seconds setting determines how long the CPU usage must exceed the threshold before a memory dump is captured. This setting can be adjusted to suit your needs.

The Monitor Frequency setting determines how often the process is checked for threshold breaches. In the example, the process is checked every 15 seconds.

Here's a summary of the Proactive CPU Monitoring settings:

  • CPU Threshold: 80% or more
  • Threshold Seconds: 30 seconds or more
  • Monitor Frequency: Every 15 seconds

Collecting and Analyzing Dumps

To collect a memory dump in Azure, head back to your app service blade and click the Diagnose and solve problems menu item.

Click the memory dump button under Diagnostic tools.

Open a Collect Memory Dump tab and click the Collect Memory Dump button.

Two dump files will be produced, and you should be able to download a .dmp file of the w3wp process which hosts your web application.

You may have to download the mscordacwks.dll from your app service, which can be found under C:\Windows\Microsoft.NET\Framework\v4.0.30319 directory.

To analyze the dump files, you can choose to analyze the data, but it's not necessary for our purposes.

App Service and Platform

Credit: youtube.com, Analyze an Azure App Service memory dump, Windows, in process, Terminate

To determine platform details and load into a debugging session, you'll need to open Windbg and load the .dmp file. First, check the output when the file was loaded to see if the application was running as x86 or x64.

The .net runtime your application is running under will also need to be determined, which will help you load the correct SOS.dll. For full framework applications, use the command .loadby sos clr, and for .net core applications, use .loadby sos coreclr.

The path to the SOS.dll will be output in the error message if the command fails, and you can then navigate to that location on the KUDU site for your application.

Expanded Command Descriptions

Expanded Command Descriptions are now more detailed, allowing you to better understand what each feature does.

The Azure App Service debugging feature descriptions have been expanded to provide more clarity on what each feature offers. You can access these features from within the Azure portal on the Diagnose and solve problems page when you select the Diagnostic Tools tile.

clear screens mockup
Credit: pexels.com, clear screens mockup

Each of the six debugging features is targeted at collecting memory dumps, making it easier to diagnose and solve problems with your App Service. These features include remote debugging, snapshot debugging, and more.

Remote debugging allows you to debug your code on a remote machine, which can be especially helpful when debugging complex issues.

Determine Platform Details

To determine platform details, open Windbg and load the .dmp file into your debugging session. You can find the platform details in the output when the file was loaded, specifically whether the application was running as x86 or x64.

To find the platform details, look for the output when the file was loaded. You can find an example of this in the image below, where the application was running as x86.

Dwayne Zboncak-Farrell

Senior Assigning Editor

Dwayne Zboncak-Farrell is a seasoned Assigning Editor with a keen eye for compelling content. With a strong background in research and writing, Dwayne has honed his skills in guiding projects from concept to completion. Their expertise spans a wide range of topics, including technology and software.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.