1

We have an ASP.NET Core 6 site in production where the memory and cpu usage looks this this:

enter image description here

The cpu peaks seems more to be a consequence of memory not being available and we see OutOfMemoryException in the logs.

We are using Application Insights but I don't find a way to see what data is getting stored in memory. The total memory consumption obviously comes from multiple things (operating system etc) but is there a way to log what data the ASP.NET Core application is storing?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96
  • You can always log info on the logger, in different locations of your code, with the total memory usage. To get this info you can use the following method: https://stackoverflow.com/a/59073095/3231884 – Luis Gouveia Dec 08 '22 at 08:33

1 Answers1

1

Profiling memory usage of ASP.NET Core 6

Created and deployed Azure App Service .NetCore 6 with Application Insights.

Check the below steps to enable Profiler for the deployed App Service

  • Enable the Always on option. enter image description here

  • Enable Profiler option from Application Insights.

  • Navigate to Your App Service => Application Insights => Make sure you have Enabled Application Insights . enter image description here

  • Turn on the Profiler option to on.

enter image description here

Transaction Search Application Insights => Transaction Search

enter image description here

  • In your Application Insights => Performance => Profiler enter image description here

Triggers => set CPU, Memory and Sampling to On and click on Profile now.

enter image description here

enter image description here

  • Click on the session to get the detailed Info. enter image description here

References taken from MSDoc

Harshitha
  • 3,784
  • 2
  • 4
  • 9