how to check what causes 100% cpu usages ?

I created a server in c# for some reason on my machine it doesn't use 100% of cpu but once I host it on a vps i see that it uses 100%
9 Replies
RD Dev
RD Dev11mo ago
Check server settings
Sossenbinder
Sossenbinder11mo ago
A good starting point is usually to check the dotnet cli tools
Sossenbinder
Sossenbinder11mo ago
https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters for checking out some common counters like GC metrics etc.
dotnet-counters diagnostic tool - .NET CLI - .NET
Learn how to install and use the dotnet-counter CLI tool for ad-hoc health monitoring and first-level performance investigation.
Sossenbinder
Sossenbinder11mo ago
You can then follow up with https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace to capture a trace
dotnet-trace diagnostic tool - .NET CLI - .NET
Learn how to install and use the dotnet-trace CLI tool to collect .NET traces of a running process without the native profiler, by using the .NET EventPipe.
Sossenbinder
Sossenbinder11mo ago
I usually like to analyze everything with dottrace, but VS also has decent support for trace analysis If you have a dottrace license you can also attach it to a remote client if you have that installed, but I think that only works properly with windows apps which barely anyone uses in net core land
Jimmacle
Jimmacle11mo ago
are you considering that the VPS probably has a weaker CPU than your machine? the CPU isn't a single unit either, there are multiple cores so depending on how your application is multithreaded you could be pegging 1 of 8 cores on your machine and 1 of 1 on the VPS
𝔄ℑ𝔇𝔈𝔑
𝔄ℑ𝔇𝔈𝔑OP11mo ago
yeah ofcourse its weaker but like I wanted to know if the mistake is from my server it self or like the vps cpu is weak and i need to upgrade it
Sossenbinder
Sossenbinder11mo ago
If you're on the cloud, honestly, just scale it up for an hour It will cost you a dollar maybe Investigating it for a few hours will cost you more
Lex Li
Lex Li11mo ago
It really depends on how much access you have on that VPS. With tools like performance profiler or WinDbg, learning the cause of high CPU is rather simple.
Want results from more Discord servers?
Add your server