0

On our production web application (.NET Framework 4.7.1) deployed as Azure App Service we've noticed high CPU usage. This seems to be occuring after every few days of application working. Same app deployed for other clients with same services tier and simmilar usage (average users) seems to be performing much better.

Took a .NET Profiler Trace from "Diagnose and solve problems" section. In generated report TOP 4 threads in terms of CPU usage take 15% each. Each of them seems to be related with garbage collector, but I don't have idea how to debug it further. I'll apreciate any clues.

.NET Profiler Trace

2 Answers 2

1

This would be very hard to answer without looking at the code of the application in question but I would suggest you sniff around the below to find the cause

  1. Check that your heavy objects such as streams and db connections are being disposed correctly (explicitly being disposed or wrapped in using)
  2. Check for string variables being assigned or overwritten correctly
  3. Check that no processes could lock your threads and force reconstruction of threads (if you handling things asynchronously or thread waiting on external resource)

Hopefully one those would point you at the root cause, best of luck!

Sign up to request clarification or add additional context in comments.

2 Comments

As for 1., 5th top CPU usage is for thread with Entity Framework which seams to be reasonable. Code review might be hard in this case, as this is quite huge application (8+ years of constant active development in 10+ devs team). Perhaps there's a way to narrow it down somehow? Maybe some other tool would provide a bit more details?
You could try using the visual studio performance monitor tool when running the application locally. Check for spikes in cpu use where you think the problem could be coming from and also monitor your memory (a spike and stabilization after boot up is normal). Most probably could be a memory leak lingering around. Another option is using jetbeans to find optimization issues, very pricy though but saves you the headache
0

You could use "Proactive CPU Monitoring. This collects a dump when the CPU is above 90% for 30s(these thresholds are all configurable); https://azure.github.io/AppService/2019/10/07/Mitigate-your-CPU-problems-before-they-even-happen.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.