How to Troubleshoot High CPU Usage on a Windows Server

High CPU usage seriously impacts Windows Server performance. It increases processing times for queued requests and reduces the number of new ones the server can accept. As load builds, the system slows down and can become unresponsive. CPU usage spikes can result from a single cause or a combination of factors.

One of the most common is running a higher-than-expected number of Service Host (svchost.exe) processes. Svchost processes host groups of related Windows services, and as more service groups become active, more svchost instances run, each consuming CPU. Other causes of high CPU usage include Windows Update, IIS, SQL Server, and malware.
This article covers how to troubleshoot high CPU usage, including issues caused by svchost, and shows you how to:

  • Monitor CPU usage from the Kamatera dashboard
  • Use Windows to find and fix issues
  • Accelerate troubleshooting with PowerShell

Note: For Linux users, see How to Monitor CPU Spikes on Kamatera, How to Get Your Server Back Online, and 6 Quick Tools to Monitor System Resources on Linux.

Monitoring CPU usage on the Kamatera console

Kamatera lets you monitor your Windows Server instance’s CPU and other useful information directly from your Server Management page. Choose a server and click Open.

How to Troubleshoot High CPU Usage on a Windows Server

From the sidebar, choose Statistics. CPU Usage displays by default.

How to Troubleshoot High CPU Usage on a Windows Server

For servers with multiple CPUs, the graph averages CPU performance across all cores. To view performance for a specific CPU, use the checklist below the graph.

How to Troubleshoot High CPU Usage on a Windows Server

The graph offers several range options, from one hour to three months, plus a custom range that lets you set a start and end date.

How to Troubleshoot High CPU Usage on a Windows Server

For greater resolution, use the start and end sliders to isolate and zoom in on a specific area of the graph.

Locating problems on the server

Kamatera’s Server Statistics shows you that a server’s CPU usage is high, but not where the problem is or what’s causing it. Finding the source means working directly on the server itself. Let’s start by opening the Kamatera console or launching a local RDP session.

Once you’re on the server, Windows has several useful built-in tools. Let’s take a closer look at three Windows tools: Task Manager, Resource Monitor, and Performance Monitor.

Monitoring processes: Task Manager

Windows Task Manager is a simple and comprehensive monitoring tool. To get started, type Task Manager in the taskbar’s search box, and click Open.

Task Manager typically opens in Processes view, showing a list of applications and their processes. Click CPU in the top row to sort processes by CPU usage.

To display detailed information by process, click Details in the sidebar.

Details view shows each running process individually, rather than grouped by application, and lets you add or remove columns to display additional information. To add a column, click the top row and choose Select columns:

From the list, check and/or uncheck the columns you want to display.

In either view, once you’ve identified a process using an unusually high amount of CPU, right-click on it and choose End Task. Before ending a process, confirm it’s safe to close. Ending a system process or an active service can cause instability or data loss.

Tracking performance: Task Manager and Resource Monitor

Task Manager’s Performance tab displays system-wide, top-level CPU performance.

To see what’s happening underneath, open the side menu and click Resource Monitor. When you launch it, Resource Monitor displays a system-wide overview. On the left, it shows how the system consumes CPU, Disk, Network, and Memory resources. On the right, it displays a graph for each resource type.

Click the CPU tab. This displays utilization by processor, services and nodes. Clicking a process displays additional information in the graph.

To include additional processes in the CPU Total, check the box next to a process in the CPU list.

Visualizing CPU usage: Performance Monitor

If the first two methods don’t give you all the information you need, Performance Monitor lets you dig deeper. It builds graphs of specific system resource counters, tracks them over longer periods, and stores the data.

To launch Performance Monitor
Open a terminal and type perfmon.

In the console tree, expand Monitoring Tools and click Performance Monitor.

In Performance Monitor, click the + icon.

From Available Counters, choose Processor.

From the list, choose % Processor Time.

From Instances of selected object, select all the options.

Click Add.

From Available Counters, choose Process > % Processor Time.

From Instances of selected object, select all the processes you want to monitor.

In the Added counters list, check that all the selected counters are displayed.

Click OK to close the dialog and save the changes.

In the graph, monitor the selected counters.

Accelerate troubleshooting with PowerShell

Windows Server’s built-in monitoring tools work well for a wide range of uses and users. Power users (such as system administrators) often want something faster, more direct, and scriptable. PowerShell, Microsoft’s scripting environment for the Windows terminal, fills that role. This section covers how PowerShell’s Get-Process and Get-CimInstance commands can help locate and troubleshoot CPU usage issues.

Get-Process: Displaying process data

Start by listing all processes running on the server using Get-Process. Open PowerShell and type:

Get-Process

This displays the following information for all running processes:

To limit the list to svchost processes, type:

Get-Process -Name svchost

To find the process with the heaviest CPU usage, sort the list by CPU in descending order:

Get-Process -Name svchost | Sort-Object -Property CPU -Descending -First 10

To display just the process names and CPU values, type:

Get-Process -Name svchost | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU

Get-CimInstance –  Displaying Detailed process information

Get-CimInstance is a powerful command that lets you display a wide range of information. You select the type of information with the appropriate Class parameter. For detailed performance information, use the Win32_PerfFormattedData_PerfProc_Proc Class. However, if you type this command without the appropriate parameters, PowerShell displays more information that you can use for process troubleshooting. Instead, use the following to display each process’s name, ID, and CPU usage in descending order.

Get-CimInstance Win32_PerfFormattedData_PerfProc_Process | Where-Object Name -notmatch '^(_Total|Idle)$' | Sort-Object PercentProcessorTime -Descending | Select-Object Name,IDProcess,PercentProcessorTime

Now, let’s modify the command to show only svchost processes:

Get-CimInstance Win32_PerfFormattedData_PerfProc_Process | Where-Object {$_.Name -like 'svchost*'} | Sort-Object PercentProcessorTime -Descending | Select-Object Name,IDProcess,PercentProcessorTime

For our last example, let’s limit the list to the top ten svchost processes sorted by CPU usage, in descending order:

Get-CimInstance Win32_PerfFormattedData_PerfProc_Process | Where-Object {$_.Name -like 'svchost*'} | Sort-Object PercentProcessorTime -Descending | Select-Object Name,IDProcess,PercentProcessorTime | Select-Object -First 10 Name,IDProcess,PercentProcessorTime

Conclusion: Getting the most from your CPUs  

High CPU usage seriously impacts Windows Server performance, but as we explained, it’s also straightforward to find and fix. We covered how high CPU usage degrades server performance and how svchost process instances are one of the most common causes. We also showed you the tools Kamatera, Windows Server, and PowerShell provide to monitor and troubleshoot CPU resource problems. Use this knowledge to keep your own systems running smoothly.

Have additional questions? Search below: