Home > OS >  A dotnet server process consumes high CPU - how to diagnose?
A dotnet server process consumes high CPU - how to diagnose?

Time:02-10

I have an ASP.NET Core process running in Kubernetes. Suddenly something gone wrong and CPU usage jumped from 8% to 100% and settled at that level. Memory usage did not changed so it looks like an infinite loop in a thread.

What instruments can I use to diagnose what is happening in the process?

What should I do to be able to diagnose such problems in the future?

CodePudding user response:

.net core support some command that let us diagnose CPU high or Memory problem.

first, install tools

dotnet tool install --global dotnet-trace
dotnet tool install --global dotnet-counters

then we can use dotnet-trace ps to get the process id that we want to trace.

then use dotnet-counters command we can see the process using resource situation.

dotnet-counters monitor --counters System.Runtime[cpu-usage] -p 22884 --refresh-interval 1

more detail you can find Debug high CPU usage in .NET Core

  • Related