Virtual Processor Limitations in Hyper-V
If you have ever experimented with the various settings in Hyper-V, then you probably know that Hyper-V offers a lot of flexibility when it comes to allocating CPU resources to virtual machines. In a way this is both good and bad. It is good, because Hyper-V allows you to achieve granular control over the allocation of system resources. The bad part is that it is possible to allocate CPU resources in a way that starves the server of processing power. In this article, I will show you why this is the case, and how to avoid it.
Virtual Processor Mapping
One of the reasons why there is so much flexibility in allocating CPU resources is that every version of Windows that has been built on the Windows NT kernel (or some variation of it) supports at least two processors. Every computer being manufactured today includes multiple CPU cores, and in many cases multiple CPUs, each of which contain multiple CPU cores.
What this means is that you have a lot of flexibility in deciding how many CPU cores you want to allocate to each guest operating system. If you look at Figure A, you can see that Hyper-V allows you to decide how many virtual processors you want to assign to a guest operating system. Before you start doing that though, you need to understand that when you assign CPU resources to a virtual machine, you’re not assigning physical CPU cores but rather virtual processors.
Hyper-V allows you to decide how many virtual processors you want to assign to a guest operating system.
A virtual processor does not necessarily have to correspond to a physical processor or to a physical CPU core. Microsoft recommends that you maintain a one-to-one ratio of virtual processors to physical CPU cores. On top of that, I recommend that you reserve at least one CPU core for the host operating system. This means that if you stick to the recommendation, a server with four CPU cores could host up to three virtual machines, with one virtual processor each (because one cores being used by the host operating system). You can also host two virtual machines, one with two virtual processors in one with one virtual processor.
So why does Microsoft allow you to have more virtual processors than you have CPU cores? There are two main reasons that I know of. First, you may occasionally run into situations in which you need to create multiple virtual machines, but not all of the machines are going to be running at the same time. For example, I have a lab server that hosts about 15 different virtual machines. Even so, there are never more than three or four virtual machines running at the same time. Had Microsoft not made it possible to assign more virtual processors than a machine has CPU cores, this type of configuration would have been impossible.
Another reason why Microsoft allows you to create an excessive number of virtual processors has to do with the entire premise of virtualization. Virtualization is based on the idea that hardware resources are often underutilized, and that you can use make better use of your hardware by running multiple virtual machines on it. Some types of virtual machines require very little CPU time. For example, in small to medium-sized networks domain controllers, DNS servers, and DHCP servers consume relatively few CPU resources. This is especially true if the servers are running on a server core deployment.
If you have multiple virtual servers, each of which are consuming very little CPU time than you can theoretically get away with having multiple virtual processors that correspond to a single CPU core. To the best of my knowledge, Microsoft doesn’t make any official recommendations as to when it is OK to configure multiple virtual machines to use a single CPU core. In my opinion, it is probably OK so long as neither machine routinely consumes more than about 25% of the core’s total processing capacity. Keep in mind that in any case I recommend setting aside at least one core for the host operating system. You should also keep in mind that if you are dividing a CPU core among multiple virtual machines, you’re going to lose some of the core’s processing power to the overhead involved in managing multiple virtual machines.
One more thing that you should keep in mind when allocating CPU resources in a Hyper-V environment is that you need to also take the guest operating system’s limitations into account. For example, Windows XP Professional is usually limited to using two virtual processors. Microsoft provides some guidelines as to the virtual processor limit for various operating systems at: http://msdn.microsoft.com/en-us/library/cc768529.aspx.
More in Virtualization
Microsoft Lifts Windows 11 Update Block As Oracle Releases VirtualBox Fix
Mar 14, 2022 | Rabia Noureen
What is a Virtual Server?
Dec 29, 2021 | Jason Wynn
Guide: How to Install Windows 11 in a Virtual Machine
Jul 8, 2021 | Michael Reinders
Microsoft Rebrands Windows Virtual Desktops, Adds New Features
Jun 7, 2021 | Brad Sams
VMworld 2020 – Announcements
Oct 5, 2020 | Michael Otey
New Features Coming to Windows Virtual Desktop Later This Year
Sep 22, 2020 | Brad Sams
Most popular on petri