One of the easiest ways to supercharge a sluggish Hyper-V virtual machine is to host the virtual machine on a RAM disk. However, while using a RAM disk has undeniable performance benefits, it is not a good option for every situation. That being the case, let’s explore when you should and shouldn’t host a Hyper-V VM on a RAM disk.
What Is a RAM Disk?
For those unfamiliar with the concept of a RAM disk, it involves treating unused RAM as though it were a hard disk. Since a computer’s memory is faster than hard disks, a RAM disk can deliver extremely good performance, even on older hardware.
RAM Disk Disadvantages
There are two primary drawbacks to using RAM disks. The first is that using a RAM disk reduces the amount of RAM available for memory. After all, if you dedicate a percentage of a system’s memory to function as a RAM disk, there will be less memory available for other things.
The second major disadvantage is that RAM is volatile. In other words, anything stored in a RAM disk is instantly erased if the computer is rebooted (although some RAM disks may perform an image dump as part of the shutdown process). This could end up being a big problem if the system reboots due to Windows updates, experiences a power failure, or suffers an unexpected blue screen error caused by an application.
Are RAM Disks Supported?
I am honestly unsure if Microsoft officially supports hosting Hyper-V VMs on RAM disks. I can confirm that Hyper-V virtual machines can indeed be run from RAM disks (I am doing it right now), but I haven’t been able to verify whether Microsoft officially endorses this practice.
Should You Use a RAM Disk?
Deciding whether to host Hyper-V virtual machines on a RAM disk depends on various factors.
Here are three questions to ask before moving a virtual machine to a RAM disk.
How much of a performance gain can you realistically expect?
When deciding whether to host a Hyper-V VM on a RAM disk, it’s important to determine whether it will result in a significant performance advantage. There are two things worth considering here.
Consider the type of hardware you currently use. If you are hosting the virtual machine on an old 5400 RPM spinning disk, transitioning to a RAM disk is likely to give you a huge performance boost. However, if your computer is equipped with the latest NVMe storage, the NVMe storage will likely be almost as fast as a RAM disk (though the RAM disk will still be faster). Unless you need to squeeze every bit of performance out of the VM, moving the VM to a RAM disk may not be worth the effort.
What type of workload is the virtual machine running? If the VM handles storage-intensive tasks that generate a lot of read / write IO, a RAM disk will almost certainly improve performance. Conversely, if the VM runs an application that hardly creates any storage IOPS, moving to a RAM disk won’t do much to improve the VM’s performance. While the operating system may boot faster, the application itself won’t see a significant performance gain.
Do you have sufficient resources available?
Another important factor is the availability of sufficient resources on your system. If most of the host’s physical memory is already in use, the machine may not be a great candidate for hosting a RAM disk. Conversely, if the machine has plenty of memory to spare, a RAM disk might be a valid option, particularly if the machine is equipped with error-correcting RAM.
What would be the consequences of an unplanned reboot?
Finally, before moving a virtual machine to a RAM disk, you absolutely must consider the consequences of an unexpected reboot or power failure. Remember, RAM disks are volatile, so their contents are instantly erased if the machine reboots or loses power. That being the case, you really don’t want to host a stateful workload on a RAM disk unless you can guarantee that the machine will never have an unexpected reboot or shutdown. It’s better to store data on backend storage and use RAM disks for hosting stateless workloads, such as web frontends.
About the authorBrien Posey is a bestselling technology author, speaker, and 21x Microsoft MVP. In addition to his ongoing work in IT, Posey has trained as a commercial astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space.em>