A slow virtual machine (VM) is a frustrating problem for end users and for admins alike. Fortunately, it tends to be relatively easy to solve. For starters, you’ll need to figure out why your VM is running so slowly. These performance problems could be for several different reasons!
In this article, I’ll explore 3 possible reasons why your VM may suffer from performance problems. I’ll also provide you with some tips on how to steer away from this problem. Let’s first start with a general overview before delving more into each of these reasons.
The Essence of VM Performance Problems
At a high level, a poorly-performing VM is due to 3 possible main reasons. All other performance problems circle back to one of these 3 high-level causes. These potential causes are:
- The VM is undersized for the workload it’s running
- Resource contention is preventing the VM from getting the hardware resources it needs
- The host or the VM is configured in a way that violates known best practices. For example, dynamically expanding virtual hard disks don’t perform as well as fixed length VHDX files
That said, these generalizations usually translate into some very specific reasons for why your VM performs poorly. Thus, let’s take a look at 3 of the most common reasons for poor VM performance in a Hyper-V environment.
1. Your VM Is Undersized
As I previously alluded to, one of the most common reasons for a virtual machine performing poorly is that the VM is undersized. Every application and every operating system comes with a list of minimum hardware requirements. These requirements don’t disappear simply because the software is running in a virtualized environment. You must ensure that the VM is configured in a way that will allocate the necessary resources to the VM.
One of the most common mistakes when setting up a brand-new Hyper-V VM is to ignore the virtual CPU. When you use the Hyper-V manager to create a new VM, Hyper-V allocates a single virtual CPU to that new VM. This tends to be inadequate for many workloads.
It’s also common for VMs to be given to insufficient RAM. RAM is often the one resource that’s in short supply. It also limits the total number of VMs that can run on a host server. As such, admins often skimp on the amount of RAM they allocate to a VM.
Simply put, you have to ensure that you give a VM enough memory to support its operating system and any applications running on it. A VM with too little RAM will often exhibit slow performance and increased disk use.
2. Storage Contention
Easily one of the most common problems associated with poor VM performance is storage contention. Every VM consumes a certain number of storage IOPS. The underlying storage array must be able to deliver enough IOPS to simultaneously meet the needs of all of the VMs running. Otherwise, your VM will suffer from performance problems.
Keep in mind, even if the storage array itself can physically perform at the required level to meet the needs of the VMs, the connectivity that ties the host to the storage array also plays a role. The connection between the host and the storage array needs to be fast enough. This is to accommodate all of the data that must be transferred between the virtualization hosts and the virtual hard disks.
Ensure you give the VM enough underlying storage array that delivers IOPs according to the needs of the running VM. You must also check the connectivity between the host and the storage and ensure it’s fast enough.
3. Too Many Checkpoints
Another extremely common reason for poor VM performance in a Hyper-V environment is the VM having too many checkpoints. These checkpoints used to be known as snapshots.
When you create a checkpoint in Hyper-V, Hyper-V creates a new differencing disk with a parent-child relationship to the original virtual hard disk. All write operations are directed to the differencing disk. In return, this leaves the original virtual hard disk in the same state it existed in at the time that the checkpoint was created. This is why it’s possible to roll back a checkpoint almost instantly, as opposed to how time-consuming it can be to restore a backup.
Generally speaking, creating a checkpoint has almost no impact on VM’s write performance. That said, checkpoints can dramatically impact read performance. Read operations are directed at the differencing disk first. If the requested item isn’t found on the differencing disk, Hyper-V will attempt to read the item from the original virtual hard disk. This slow read performance is compounded as you accumulate more and more checkpoints.
From a performance standpoint, it’s best to avoid using checkpoints altogether if you can. If you must use checkpoints, you should make every effort to minimize the number of checkpoints that exist at any one time.
The Bottom Line
A Hyper-V VM might run more slowly than it should for countless reasons. That said, all of these reasons stem from 3 main causes. These causes are: resource contention, undersized VMs, or a VM configuration that violates best practices.
In this article, you’ve come to know about each of these causes and some pro tips to avoid falling victim to each. If you have any more questions about slow-running VMs, check out the FAQ and Resources sections below.
Why is my workload slow even though the VM it runs on is performing normally?
The important thing to remember in these situations is that workloads aren’t necessarily confined to an individual VM. Many workloads have external dependencies like an external database or service. These dependencies generally run on separate VMs or even in containers. If your workload VM runs well, it could be that the performance problem lies with the VM hosting a dependency service.
What does it mean to right size a VM?
Right sizing a VM refers to the practice of ensuring a VM is allocated the hardware resources it needs. That said, this is without assigning excessive resources to the VM. Assigning excessive resources to a VM reduces the total number of VMs that can simultaneously run on the host server (the VM density). The goal for a virtualized environment should be to maximize the potential VM density without introducing performance problems in the process.
What resources do I assign to a VM to maximize the potential VM density?
Every workload’s needs are unique. The only way to truly determine exactly what resources a workload needs is to use the Performance Monitor. This is to see how the VM interacts with the virtual hardware. That process is complex and requires a lot of trial and error. As an alternative, Microsoft provides a set of generic recommendations for right sizing VMs based on the workload type.
What can I do if a neighboring VM consumes too many resources?
If a neighboring VM consumes excessive resources (the so-called noisy neighbor syndrome), you have a few options. One option is to move the VM to a different host. Another option is to use resource quotas like Storage QoS to constrain the noisy neighbor’s hardware use.
Can Windows Update cause VM performance problems?
In some situations, the update process has caused update storms, resulting in diminished performance. That said, these problems tend to be short lived. In recent years, Microsoft has used peer updating to reduce the impact of the update process.
TechGenix: Guide to Speeding Up Slow Internet
TechGenix: Article on Slow Domain Controllers
Read more on why your domain controllers might be slow.
TechGenix: Article on Slow VM Performance
Find an entire series of articles on slow virtual machine performance.
Nakivo: Article VM Performance Tips
Discover 20 tips to improve virtual machine performance.
Altaro: Guide to Hardware Tweaks to Boost Hyper-V Performance
Tweaks: Tips for VM Performance
Find some additional tips to tweak virtual machine Performance.