Resource Allocation in Hyper-V (Part 1)

by [Published on 2 June 2008 / Last Updated on 2 June 2008]

Proper resource allocation is critical to effectively hosting virtual machines. This article series explains how it is done.

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

When virtual machines were initially introduced, the basic idea behind using them was fairly simple. Many servers, such as DHCP servers and DNS servers don’t even come close to using the hardware’s full potential. In fact, often times less than ten percent of a server’s processing power is actually used on an ongoing basis. This under utilization of resources has been further compounded as processors have grown to be more powerful over the years. Virtualization allows companies to save money on hardware costs by making better use of a server’s available resources, by allowing multiple virtual machines to use resources that would otherwise have gone to waste. When implemented properly, this is a great alternative to spending lots of money on multiple physical servers.

Of course the real trick is configuring the host operating system and the guest operating systems to use resources in an efficient manner. After all, you want to gain the maximum usage out of your hardware, but at the same time, you don’t want to end up in a situation in which the server’s resources are spread too thin and performance begins to suffer. In this article, I’m going to try to walk you through this rather delicate balancing act.

Before I Begin

Before I get started, I want to explain that resource allocation methods vary considerably depending on what virtualization software you are using. The techniques that I am going to be discussing are intended for use with Microsoft’s Hyper-V. If you are using VMware or Microsoft’s Virtual Server or Virtual PC, then the basic concepts that I will be discussing will still be relevant for the most part, but you are going to have to make some adjustments to account for the needs of the virtualization product that you are using.

Host Operating System Configuration

I want to start out by talking about the host operating system. All of the guest operating systems are dependent on the host operating system, so it is important for the host operating system to be configured properly.

The first thing that you need to know about the host operating system is that you must be running a 64-bit version of Windows Server 2008 in order to use Hyper-V. Your guest operating systems will be able to run either 64-bit or 32-bit operating systems, but 64-bit is an absolute requirement for the host operating system.

Another requirement that you need to be aware of is that your hardware must support hardware level virtualization. In Microsoft’s previous virtualization products, the virtual machines ran on top of the host operating system, and any calls to the hardware were passed through the host operating system. This approach proved to be very inefficient though. With Hyper-V, guest operating systems communicate directly with the server’s hardware. This results in much better performance than what was previously possible, but it also means that you won’t be able to run Hyper-V unless your server supports hardware level virtualization.

Hardware level virtualization is available on both Intel and AMD platforms. If you are using an Intel processor it must support Intel VT (Intel Virtualization Technology). You can read more about Intel VT. AMD’s virtualization support is called AMD-V, which you can read about here.

OK, I’ve talked about some of the absolute requirements for the host operating system, but let’s talk about the resources that the host operating system will need.

When it comes to virtualization, one of the most important resources that you will have to manage is memory. I recommend allocating 2 GB of RAM to the host operating system. Keep in mind that you don’t have to perform any special procedure to allocate memory to the host operating system, but you do have to specify how much memory you allocate to the guest operating systems. Your memory should be allocated in such a way that when you total the amounts of memory that are being used by all of the guest operating systems that are running simultaneously, there is at least a 2 GB difference between the sum total of the memory being used by your virtual machines and the total amount of memory that is installed in the server.

Obviously, you may need more or less memory depending on how Windows Server 2008 is configured. This brings up another good point though. Your host operating system’s only job is to host guest operating systems. Therefore, Hyper-V should be the only server role that is installed. If you need to run additional roles, then those roles should be installed in a guest operating system. Your host operating system needs to be able to service the guest operating systems with maximum efficiency, and it can’t do that if additional roles are installed.

One thing that I want to quickly mention before I move on is that although it is considered to be a bad practice, it is possible for the host operating system to host additional server roles. However, I have run across several posts on the Internet that have said that installing the Hyper-V role on a domain controller essentially destroyed Windows. I have never tried this myself, so I can’t tell you exactly what happens if you do try to install Hyper-V on a domain controller. Even so, enough people have blogged about the problem that I thought that I should at least mention it to you.

Network Cards

It might sound a little strange, but it has been my experience that network cards can actually be one of the biggest bottlenecks in some situations. For example, if you are sunning several virtual machines, each of which is running one or more network intensive applications, then a network connection could quickly become saturated.

Hyper-V is designed in such a way that you can install multiple network cards in your server, and then assign a different NIC to each virtual server instance. In an ideal situation, you should have a NIC for the host operating system, and a dedicated NIC for each guest operating system. This isn’t always possible though.

For example, I have a server that I use to host several virtual machines. Although this is a fairly high end server, it only has three expansion slots. Two of those expansion slots are filled with RAID controllers, so that only left one expansion slot that I could use for a NIC. Fortunately, the server also features an integrated NIC, giving me a total of two gigabit connections, which meets my needs. I just assigned each virtual machine to use one NIC or the other, based on the amount of network traffic that I expected the virtual machine to generate.

Keep in mind that distributing virtual machine related network traffic across your available NICs does not always mean assigning half of the virtual machines to one NIC, and half of the virtual machines to the other. Some virtual machines are going to send or receive a lot more traffic than others, and this is an important consideration when assigning NICs to a virtual machine. The good news is that Hyper-V is flexible enough that you can reallocate NIC usage at a later time if necessary. Switching NICs does require you to shut down the virtual machine though.

Conclusion

In this article, I have begun discussing resource allocation for virtual machines. In the next part of this article series, I will talk about memory and CPU utilization.

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

Featured Links