Out of Memory Exception on Azure App Service

CS 0 Reputation points
2024-09-06T14:14:47.8866667+00:00

I'm hosting 8 apps on my App Service plan (Premium v3 P1mv3) with 16 GB of memory. We are consistently encountering Out of Memory Exceptions though our memory usage never spikes above 40%. Our application is a Project Management tool the Out of Memory Exception is triggered in multiple spots but most consistently when uploading photos. When the error occurs restarting the service consistently allows the user to complete the action that had triggered the error.

I am looking for some insight on why this might be happening.

Below are a couple of thoughts:

The minimum interval on the memory usage is 1 minute. Is the issue I can't see the spikes because they come and go within that interval? If so is there another way to view the usage?

Is the memory parceled out among all the Apps running on the service such that even though there is 16GB of memory each App has a memory cap lower than that even if there is additional memory available on the plan?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,913 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,636 Reputation points Microsoft Employee
    2024-09-07T00:15:46.43+00:00

    Hey @CS

    So, the best way to think about an app service plan is that it is the computer. for your applications in the cloud So the 16GB of ram that is associated with the P1mv3 will be shared amongst your eight applications.

    In order to determine what's causing your out of memory exception, you really have to capture the diagnostics from your app service plan. Capture memory dumps on the Azure App Service platform - Azure | Microsoft Learn can guide you through capturing memory dumps of the app service, but here some general steps to help narrow things down.

    • Use Azure Application Insights to monitor memory usage. Look for patterns in memory consumption, such as a steady increase over time, which might indicate a memory leak.
    • Use the Diagnose and solve problems tool to capture memory dumps. This can help you analyze the memory usage of your application at the time of the exception.
    • Leverage tools like PerfView to analyze memory dumps. Look for objects that are consuming a large amount of memory and investigate why they are not being released.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.