Windows Server 2022, high CPU use from "taskhostw.exe"

Eric Wendt 5 Reputation points
2023-07-20T16:32:09.5566667+00:00

Hello, we've been a little puzzled at trying to track down what may be causing a high CPU usage from a particular application.

We've recently built out new DC servers under the Windows Server 2022 OS. In all of these servers, we've noticed the CPU usage is always at 100%. Upon investigating, I see that the "taskhostw.exe" application is consume at least 85% or more on a consistent basis.

Now, I understand that this application is a 'handler' for multiple services that feed into it; the problem is pinpointing what service is consuming so much of the CPU.

Screenshot_1.png
Screenshot_2.png

Even after clean reboots, the problem persists.

I've seen it suggested to check the properties of this app and then the "Threads" tab to see what .dll file is being referenced, but as you can see, none exist: Screenshot_3.png

Also, I have seen it suggested that perhaps the "StorageSense" task is to blame (Task Scheduler > Task Scheduler Library > Microsoft > Windows > DiskFootprint): Screenshot_4.png

But I have stopped this task before and did not see any difference.

I should note that Windows Defender is turned off as we have our own security from a third-party vendor, so one might naturally assume it would be Defender running in the background scanning.

These are critical servers so with the exception of outside business hours, constant restarts during the day isn't feasible.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
11,707 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Wesley Li-MSFT 4,436 Reputation points Microsoft Vendor
    2023-07-21T03:04:48.6166667+00:00

    Hello

    In addition to TaskManager and Process Explorer, there are several tools that can help you check for threads that are causing high CPU usage.

    One such tool is ProcDump, which can be used to take memory dumps during CPU spikes. Then you can inspect the call stacks of all threads.

    https://learn.microsoft.com/en-us/sysinternals/downloads/procdump

    Another tool you can use is perfmon, which allows you to monitor your system's performance and keep checking for threads that are hogging the most CPU.

    https://www.digitalcitizen.life/basics-about-working-performance-monitor/

    Of course, if it is outside of working hours and the server can be restarted, you can also try to collect user mode dumps to analyze the root cause.

    https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps

    If the response is helpful, please click "Accept Answer" and upvote it.


  2. David Llewellyn 0 Reputation points
    2023-12-26T17:17:13.7166667+00:00

    I am seeing the same and believe it is the StorageSense scheduled task that is responsible. I suspect the task kicks off and the taskhostw.exe process is started by this. I don't think stopping the scheduled task would stop the taskhostw.exe process, as it appears to be a runaway at that point. To be sure if the StorageSense task is related, I would recommend disabling the task from running for a period and see if the issue stops for that particular server. If not, then it is something else and you can re-enable the scheduled task. I am using GPO to disable StorageSense on my servers for the time being:

    gpedit - Change Computer Configuration > Administrative Templates > System > Storage Sense > Allow Storage Sense to Disabled.


  3. Shawn Doné 0 Reputation points
    2024-02-01T13:17:55.77+00:00

    Hi David, Yes, I too have noticed that undoing the checkbox and adjusting the areas within gpedit have not made any difference. I also added, in the same gpedit location, a "disabled" state to the "Allow Storage Sense Temp FIles cleanup" thinking that might help as well but I have not seen any changes. I'm at another dead end on my side. Keep me posted and I will do the same. Shawn

    0 comments No comments