Organizations seek to maximize the return on their server hardware investment by maximizing their virtual machine density. The idea behind this concept is that the more virtual machines a Hyper-V host can accommodate, the lower the hardware cost per VM. One of the best things that an organization can do if it wants to increase its virtual machine density is to decrease its background activity. Background activity increases the virtual machine’s memory and CPU requirements and may also increase the number of storage IOPS produced by the virtual machine.
There are several things that you can do to decrease your virtual machines’ background activity. Most (but not all) of the techniques that I will share with you make a very trivial difference in a virtual machine’s resource consumption. When you combine these techniques and apply them to large numbers of virtual machines, the changes can collectively make a significant difference.
Windows Desktop Experience
One of the single most effective things you can do (if you haven’t already) is to remove the Windows Desktop Experience from your Hyper-V virtual machines. Keep in mind that removing the Windows Desktop Experience does not eliminate your ability to manage Windows from the GUI. You can simply install the management tools on another machine (such as a Windows desktop) and manage Windows remotely rather than directly through the virtual machine console.
Another thing that you may be able to do to decrease a virtual machine’s hardware resource consumption is to disable any scheduled tasks that are not specifically needed. The Windows operating system includes a Task Scheduler and schedules dozens of automated tasks to run periodically. If you look at the image below, you can see that this particular system has 70 tasks defined, and 54 of those tasks are currently enabled. Tasks created by Microsoft are usually necessary for keeping the operating system healthy, but there may be other tasks that you can disable.
it is also a good idea to make sure that the screensaver is disabled for both the host operating system and for the virtual machines. Screen savers consume CPU cycles that could be better used for other purposes.
It may sound a bit counterintuitive from a resource consumption standpoint, but it is important to make sure that you regularly apply any available updates through your Windows virtual machines. On the one hand, the update process consumes memory and CPU cycles while also generating storage IOPS. This would seem to go against the goal of reducing resource consumption. Never mind the fact that updates often result in annoying reboots.
The reason why it is so important to apply all the latest updates (besides the security implications) is because updates often include bug fixes and tweaks that help Windows to run more efficiently. Perhaps more importantly from a Hyper-V standpoint, Windows Update keeps the Hyper-V Integration Services up to date. Running the latest version of the Integration Services helps ensure that the virtual machine interacts with the underlying hardware in the most efficient way possible.
Another thing that you can do to help minimize unnecessary hardware resource consumption is to review the hardware resources that have been allocated to your virtual machines. More specifically, there are four things that you need to be on the lookout for.
The first thing you need to check is the amount of memory allocated to each virtual machine. If you are trying to maximize your virtual machine density, then it may be tempting to skimp on memory allocations, but your virtual machines need to have enough memory available to run their respective workloads. A virtual machine that has been allocated too little memory can cause CPU spikes and an increased demand for storage IOPS. Of course, you don’t want to waste memory by allocating more memory than your virtual machines need. The best option is to configure your virtual machines to use dynamic memory and then use the Performance Monitor to make sure that the virtual machines are not suffering from excessive memory pressure. I recently wrote an article here at TechGenix on this subject.
The second thing you should do when reviewing your virtual hardware is to look for (and remove) any unnecessary hardware allocations. For example, an administrator who needs to install an application onto a virtual machine might create a virtual DVD drive that maps to an ISO file containing the installation media. While there is nothing wrong with installing an application in this way, it’s important to remember to remove the virtual DVD drive once it is no longer needed. This helps to free up system resources that can be put to work elsewhere.
The third thing to watch out for is virtual machines that use emulated network adapters. In most organizations, it is really rare to find a virtual machine using an emulated network adapter. At one time, it was necessary to use an emulated network adapter on non-Windows virtual machines and for virtual machines running older versions of Windows. If you have older virtual machines in your organization, it is possible they are still using emulated network adapters, even if the guest operating systems have been upgraded.
Finally, take a look at how many virtual CPUs each VM is using. It’s counterintuitive, but one way of increasing virtual machine density is to assign a single virtual CPU to each VM unless the VM is running an application that specifically requires additional CPUs. This is because there can be a significant amount of overhead involved in scheduling threads to run on multiple virtual CPUs. Of course, if the CPU resources become a bottleneck, you can and should allocate additional virtual CPUs to the virtual machine.
The items that I have discussed are by no means the only techniques for reducing a virtual machine’s hardware resource consumption. Often, there will be other things that you can do that are specific to the application or service that a particular virtual machine is running.
Featured image: Shutterstock