Maximizing Your Virtual Machine Density in Hyper-V (Part 1)

If you would like to read the other parts in this article series please go to:

Introduction

When server virtualization first started to become practical, it was often advertised as a solution that would help to reduce hardware costs through consolidation. Now that server virtualization technology has had time to mature it is apparent that there are many additional benefits to virtualizing servers, and yet hardware consolidation remains one of the primary benefits. In fact, some organizations have adopted server virtualization as a way of maximizing the return on their hardware investment.

If an organization gets into server virtualization with a stated goal of getting the most from their server hardware then it makes sense to look at ways of maximizing the number of virtual machines that are running on each host server. This practice is often referred to as maximizing the virtual machine density.

Some Words of Caution

There are a number of different techniques for improving a host server’s virtual machine density. Before I begin discussing those techniques however, I need to take some time to discuss some of the potential problems that you could encounter by doing so.

In order to maximize virtual machine density on a host, there are two things that you will have to do. First, you must minimize the hardware resources that are allocated to each virtual machine. Second, you will generally have to share some resources (such as CPU cores) among a greater number of virtual machines. As you do these things, you must keep in mind that there is a tradeoff between virtual machine density and virtual machine performance. Simply put, a virtual machine cannot be expected to perform well unless it has been provisioned with adequate hardware resources. In extreme cases a virtual machine that has insufficient hardware can become instable.

Another issue that must be considered prior to increasing virtual machine density is that virtual machine resource consumption is not linear. A virtual machine that has been assigned exactly the right amount of resources to handle normal operations might be unable to cope with spikes in demand. Such spikes can be caused by an increase in user activity, operating system background processes, or even by routine maintenance tasks such as backups or malware scans. The point is that there are times when virtual machines will need additional resources and you must have a plan for making the required resources available.

Another consideration that is critically important is the way that virtual machine density effects fault tolerance. Most production Hyper-V deployments operate as a part of a Windows failover cluster. Without clustering the failure of a single host server would result in a major outage since all of the virtual machines running on the failed host would also go down.

There are two things that you will need to keep in mind with regard to failover clustering. First, each cluster node will need to have a sufficient amount of hardware resources available to allow it to function as a part of the cluster. Failover clustering isn’t super resource intensive, but the cluster members must be able to send, receive, and process heartbeat traffic in a timely manner.

The other thing that you will have to keep in mind about failover clustering is that cluster nodes must have sufficient resources available to allow a failover to occur. Yes, CPU, memory, and network resources are used during the transition process that occurs as a part of a failover and you must make sure that those resources are available, but there is more to it than that.

Imagine that you have a failover cluster consisting of three Hyper-V hosts and that all three hosts are running the maximum number of virtual machines that the hardware can comfortably support. Now imagine that one of the host servers fails. When this happens the virtual machines that were running on the failed host are supposed to be automatically live migrated to the cluster’s remaining hosts. However, if the remaining hosts are already running all of the virtual machines that they can handle then the virtual machines cannot be live migrated because they have nowhere to go. Incidentally, this crucial point brings me to lesson number one for maximizing virtual machine density – virtual machine prioritization.

Virtual Machine Prioritization

As I explained in the previous section, you can’t completely maximize the number of virtual machines that are running on every node in a cluster because if you did then virtual machine failover becomes impossible. However, in Windows Server 2012 / Hyper-V 3.0 Microsoft introduced a new feature called virtual machine prioritization. Virtual machine prioritization does not completely address the problem of overloaded cluster hosts, but it does help in some situations.

The basic idea is that most organizations have some virtual machines that are more important than others. For example, a mission critical application server could be considered to be a very important virtual machine. Conversely, a redundant domain controller might be an example of a virtual machine that is of minimal importance. Virtual machine prioritization works by shutting down low priority virtual machines (when necessary) so that high priority virtual machines are able to keep running.

Although it might seem to be counter intuitive, virtual server prioritization is not actually a Hyper-V level function, Instead, it is handled by the Failover Clustering service. You can set the priority for a virtual machine by opening the Server Manager and then selecting the Failover Cluster Manager command from the Tools menu. When the Failover Cluster Manager opens, select the Roles container and then right click on the virtual machine whose startup priority you wish to modify. Next, choose the Change Startup Priority command from the resulting shortcut menu. You can now assign a priority to the virtual machine.

Conclusion

As you can see, there are a number of issues that absolutely must be taken into account before you attempt to squeeze the highest possible virtual machine density onto a Hyper-V host. This isn’t to say that you shouldn’t try to maximize the return on your hardware investment, but rather that you must be careful when doing so. There is a very fine line between making the most efficient possible use of physical hardware resources and stretching those resources so thinly that things begin to break.

One way that you can lessen the consequences of resource over commitment is to prioritize your virtual machines. By doing so, you are effectively giving Hyper-V permission to shut down low priority virtual machines (if necessary) in a failover situation so that higher priority virtual machines can continue to run.

Of course virtual machine prioritization is far from being the only technique that you can use to achieve the highest possible (or highest practical) virtual machine density. There are many other techniques and best practices that I will be discussing as this series progresses.

If you would like to read the other parts in this article series please go to:

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top