Server virtualization helps you save money on hardware -- and the more machines you host, the more money you can save.
One of the big selling points of server virtualization is that it allows an organization to reduce hardware costs through server consolidation. So the best way to maximize the ROI on your server hardware is to use the hardware to host as many virtual machines as possible. Here are five techniques you can use to fit more virtual servers onto a Hyper-V host.
1: Overprovision storage resources
Our first tip is to overprovision storage resources. Hyper-V allows you to create virtual hard disks of a fixed size or to create dynamically expanding virtual hard disks. Dynamically expanding virtual hard disks grow as you add data until they reach the maximum size you have specified.
This technique can help you because it allows you to allocate far more virtual storage than your physical storage can actually accommodate. For example, if you create a 100 GB virtual hard disk, it will actually consume less than 1 GB of physical disk space until you begin adding data. As you add data, the virtual hard disk file will grow to only as large as is required to accommodate the data.
Even though this technique lets you create more virtual machines than might otherwise be possible, you have to make sure that your server does not run out of physical storage space. It is also worth noting that although virtual hard disk files grow to accommodate data, they do not shrink as data is removed.
2: Install as much memory as the server will accommodate
The number one thing that limits the number of virtual machines that can operate on a host server at any given time is physical memory. Therefore, if your goal is to fit in as many virtual servers as possible, you would do well to upgrade your host server to the maximum amount of memory it can accommodate. In some cases, you might be able to install even more memory by also upgrading your server's system board.
3: Use dynamic memory
The reason why memory is such a limiting factor for Hyper-V is that memory must be allocated to a specific virtual machine. It can't be shared by multiple virtual machines.
In Windows Server 2008 R2 SP1, Microsoft introduced a new feature called dynamic memory. Dynamic memory treats the server's physical memory as a sharable resource that can be dynamically reallocated as needed. When dynamic memory is in use, Hyper-V adds memory to or removes memory from virtual machines as the workload changes.
When you use dynamic memory, you simply specify how much memory should be allocated to a virtual machine at startup, the maximum amount of memory that the virtual machine should ever use, and a memory buffer value. The memory buffer is a percentage beyond what is actually required. For example, you might give virtual machines a 20% safety buffer.
When you use dynamic memory, take care to provide each virtual machine with sufficient memory. Also note that some types of virtual machines do not work well with dynamic memory. For example, Exchange 2010 mailbox servers will consume all the memory you give them, regardless of whether dynamic memory is being used.
4: Remember the relationship between virtual and logical CPUs
Microsoft defines a logical CPU as a physical processor core. For instance, a twin processor server with four cores on each processor would have eight logical CPUs. When you add CPUs to virtual machines, however, you are adding virtual CPUs, not logical CPUs. It is possible to overcommit your system's physical CPU resources by allocating more virtual CPUs than you have logical CPUs.
In most cases, you can get away with this type of overcommitment without any negative consequences, so long as you don't go overboard. Using a 2-to-1 ratio of virtual CPUs to logical CPUs is usually safe if your virtual machines aren't carrying a heavy workload.
5: Offload traffic to the virtual network
One host server resource that is easy to overlook is network bandwidth. Your network bandwidth must be shared among all of the virtual machines and the host operating system.
It is a good idea to install as many physical NICs as possible into your host server. You should reserve one NIC for the host operating system and use the remaining NICs for the virtual servers. Ideally, it would be nice to give each virtual machine a dedicated NIC, but doing so is usually impossible.
You can conserve network bandwidth by offloading some of your traffic to a virtual network segment that is not connected to the physical network. For example, you might create a server backbone segment that exists only as a virtual network and that's not attached to the physical network. That way, traffic flowing between virtual servers never has to traverse the physical network.