Part 2: CPU-based Performance Constraints
Performance issues related to CPU-based constraints are the most common and easiest to identify. All you need to do is observe the Windows Task Manager while the problem is occurring. The Performance tab will clearly show you if CPU utilization (as a percentage of total) is high or low. If you’re seeing total CPU constantly spiking or flatlining at 75% or more, you’re likely CPU constrained.
High CPU utilization may be the result of some other issue that’s causing CPU usage to be high. For instance, if free RAM is low and the OS starts paging RAM contents to disk, this will spike CPU and disk activity -- but the root cause of the problem will be RAM exhaustion, not CPU usage. Therefore, it is important to understand precisely what is causing high CPU usage and why.
CPU usage is typically measured in % CPU utilization of total CPU capacity available. This is important, because it is nothing more than the ratio between “how much CPU is being used” divided by “how much CPU is available”. This means that the usage can be high as a result of high CPU demand by users (e.g. watching YouTube) and applications or low amounts of available CPU (e.g. under-provisioned VM) – or both. Therefore, the resolution to a CPU-based performance constraint is simple: reduce demand on CPU and/or increase the amount of available CPU.
Understanding how much CPU is available is easy. Just look at the Task Manager performance tab to see how many cores or logical processors there are in your VM.
Understanding what is consuming the CPU and how much is being consumed can be done by looking at the Task Manager details tab and sorting the list of processes according to the CPU column in descending order. You can also add the “CPU Time” column to see which process has been consuming a lot of CPU in aggregate over time since the VM booted up.
What you’re looking for here is unusually high usage patterns for a single or handful of processes that are not expected. If a process (other than System Idle Process) is at the top of the list most of the time, you need to determine whether that’s expected or the process is having an issue and may need to be killed. If CPU utilization is high but the list of processes looks normal, with each process consuming a fraction of the CPU capacity, then it’s likely that the actual, legitimate load placed on the VM exceeds its available CPU.
How CPU contention manifests itself to the end-user
- “Not responding” applications
- Slow log on and log off
- Slow launching of new applications, opening, and saving files
- Slow switching between windows
- Spinning (loading) cursor
- Web page loading slowly
- Pegged CPU can sometimes mimic network performance issues (audio distortion, slow screen refreshes) when the agent can’t keep up
Practical steps to troubleshoot and resolve CPU related issues
- Connect to session host VM and look on performance tab of Task Manager. If CPU is consistently low or moderate, then move your troubleshooting on to another system component.
- If CPU is spiking high and frequently or staying near the top consistently, determine if this is normal behavior or if something unusual is happening. Check the details tab in Task Manager and look for any processes at the top of the sorted list that aren’t expected to be there.
- If there is an offending process at the top of list, investigate what it is, what user it is running under, and why it is keeping the CPU so busy. Terminate the process if appropriate or take steps to optimize it depending on what it is.
- If all processes are as expected and none are using an excessive amount of CPU constantly, then add more capacity or decrease load to improve performance.
- To increase capacity, increase the size of the VM
- To decrease CPU load, spread users out across more session hosts
- In most scenarios, WVD session hosts are CPU-bound, meaning that you will run out of CPU capacity before running out of RAM capacity. The most common VM families are Ds-series (v3 and v2) and Es-series.
- Here are some common mistakes that we often see lead to CPU-related performance issues
- Using burstable (B-series) VMs for production workloads. These VMs may look like they have decent amount of CPU, but they have associated CPU quotas that limit how much of that CPU can be used. Don’t use B-series VMs as session hosts in production (learn more about B-series VMs in the Nerdio Academy).
- Leaving unnecessary start-up items that launch with every user login and needlessly consume CPU. The more users log in, the more processes start up and the more CPU is wasted. Check the All Users StartUp folder (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp) for any items that don’t belong. This should typically be an empty folder in a WVD deployment.
- When deploying WVD session hosts from an image, updates may be installing every time a session host is deployed. This happens when Windows Update was run on the template VM but the update didn’t finish installing. Creating an image and then deploying session hosts from this image will install these updates (very CPU-intensive process). Be sure that updates are fully installed on the template VM before capturing it as an image. Allow the template VM to stay on for a long time and watch the CPU graph in Task Manager. Once all CPU activity dies down, capture the image.
- Streaming services like Pandora, Spotify, and YouTube consume a ton of CPU on virtual desktops rendering and encoding media. These offenders can be easily seen in Task Manager during performance issues and will be at the top of the list. Educate your users to stream on their local devices and not on the virtual desktop. This will increase performance for others and reduce your bandwidth costs.
Be sure to subscribe to our newsletter so you don't miss it -- or any other new content!