High CPU usage is one of the most common issues that affects web servers. There are several root causes related to server hardware, website traffic or application code.
If you use the same instance of an object which is not thread-safe multiple times, this may increase the CPU usage. More specifically, using the same HttpClient instance from different threads increases the CPU usage.
The issue may surface in many ways. One if them is -obviously- high resource utilization. You can monitor the resource usage in Task Manager, Resource Monitor or Performance Monitor.
The official documentation for HttpClient recommends using only one instance of this object (Source HttpClient Class). However, for the scenarios where requests step on each other, it’s better to create more than one instance.
Applications shouldn’t depend on one instance of HttpClient if the requests overlap each other. Instead of calling the same instance of HttpClient, using new instances of it should help IIS to reduce CPU usage.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.