I have developed a website in Asp.Net Core 2.2 and hosted on Azure VM (Windows Server 2016 Data Center) in IIS.
I observed that when I access the website then after few requests, it's CPU usage goes to 100% and website does not respond. When I kill the process (.Net Core Host), then website works fine and then again process consume 100% CPU.
I searched a lot in this and found no solution. Many people are suffering with this and still struggling.
Did anyone encountered this problem and found the solution or any workaround? I am open to upgrade (core 3.0) or downgrade (2.0) for my application if it solves the problem.
Any help would be really appreciated.
Edit: After searching on this, i came to know this https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/690#issuecomment-399046332
That person downgraded the application core v2.1 which solves the high cpu usage problem.
Fix high CPU usage in the IIS worker process. To fix the high CPU usage, you will need to do two things: Eliminate the blockages causing poor performance under high CPU usage (making your workload more elastic). Reduce CPU usage of the application code, to avoid CPU overloads and be able to handle more traffic.
Using in-process hosting, an ASP.NET Core app runs in the same process as its IIS worker process. In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter, a network interface that returns outgoing network traffic back to the same machine.
May be your application runs multiple threads. I have same issue that runs multiple threads and in each thread there is continuous update which makes the application usage from 50% to 100%.
Finally I fixed the problem by downgraded the framework from asp.net core v2.2 to asp.net core v2.0.0
Upper versions are not stable yet.
In my case one instance of 'HttpClient' makes CPU usage high, When I changed the code and create new instance for each request CPU usage went down, because of 'HttpClient' disposing problem with more than one instance and a lot of request in my scenario 'HttpClient' was replaced by 'HttpWebRequest'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With