Probably the trickiest thing about operating virtual servers is the proper allocation of hardware resources. Allocate too few resources, and performance starts to suffer. Allocate too many resources, and you waste capacity and might not be able to host as many virtual machines. The key, therefore, is to allocate just the right number of hardware resources to each VM. Anyone who has ever administered a Hyper-V server can tell you that resource allocation is an art form. Most of the Hyper-V admins that I know, work diligently to optimize virtual machines and to use the available hardware resources as efficiently as possible. But what about the host OS?
The host operating system runs inside of a root partition. According to Microsoft, “the root partition is itself a virtual machine partition, although it has unique properties and much greater privileges than guest virtual machines.” Because the root partition is a type of virtual machine partition, it makes sense that careful hardware allocation would be just as important for the root partition as it is for the virtual machine partitions.
But how do you allocate resources to the root partition? The Hyper-V Manager allows you to allocate resources to the virtual machines, but not to the root partition. Unfortunately, it isn’t quite as easy to allocate resources to the root partition as it is to a virtual machine partition (although you can leverage host reserves).
In Windows Server 2016, Microsoft quietly introduced a new feature that allows you to manually take control of logical processor allocation for the root partition.
Since its introduction, Microsoft has steadily increased the number of logical processors that can be allocated to a partition. Currently, Hyper-V can support up to 512 logical processors, but the root partition is limited to using 320 logical processors. The question is, however, does the root partition really need 320 virtual processors?
If you have a really large Hyper-V server, then there is a chance that your root partition will need as many logical processors as Hyper-V can give it. In most cases, however, the root partition can easily get by with far fewer logical processors than Hyper-V is willing to give it.
The new Windows Server 2016 feature that allows you to manually control host logical processor allocation cannot be used to overcome the hard limits that have been put into place by Microsoft. It can, however, be used to artificially reduce the logical processor allocation for the root partition, thereby potentially freeing up resources for use by virtual machines.
To take control of the host’s logical processors, you will have to leverage the BCDEdit command. On the surface, this probably sounds a little bit odd, because the BCDEdit command is normally used for managing the boot process. In fact, the BCD in BCDEdit stands for Boot Configuration Data. You can find a full description of the BCDEdit command here.
The reason why the BCDEdit command is used is because, believe it or not, the command can be used to modify low-level hypervisor settings. If you take a look at the command syntax referenced in the previous paragraph, you can see that the Debug section contains a HypervisorSettings switch. In this particular case though, we won’t be using the HypervisorSettings switch, but rather a much more generic switch called Set. According to the documentation, the Set switch “sets an entry option value.”
So before we get started, take a look at the figure below. This figure shows the performance data for a Hyper-V server in my lab. As you can see, the server is equipped with an AMD FX(TM)-8350 Eight-Core Processor. If you look at the summary information beneath the chart, you can see that the system is running at 3.99GHz, and that it has a single socket, four cores, and eight logical processors. You can also see that virtualization is enabled.
So now let’s set a hard definition for the number of host logical processors. To do so, open the command prompt window (as an administrator), and enter the following command:
BCDEdit /Set HypervisorRootProc n
In this case, the letter “n” at the end of the command is simply a placeholder. You will want to replace the letter n with the number of hypervisor root processors that you want to use. Since my server is equipped with such a modest number of logical processors, I am going to set the number of host logical processors to two. You can see what this looks like in the figure below.
As I mentioned earlier, the BCDEdit command is a tool for modifying the boot process. It should, therefore, come as no surprise that the change will not go into effect until you reboot the server. Microsoft does not provide a way of changing the number of host logical processors without rebooting.
After making the change shown in the previous figure, I rebooted my lab server and opened the Task Manager once again. You can see what it looks like in the figure below. At first glance, it would appear that the Task Manager shows exactly the same information as before. If you look a little more closely, however, you will notice that the summary information now displays the number of host logical processors, which has been set to two.
Making modifications to the number of host logical processors that are available to a Hyper-V server can help you to gain more direct control over the way that your host server allocates hardware resources. Even so, manually setting the number of host logical processors in a Hyper-V server has the potential to improve or to diminish the server’s overall performance. Therefore, my advice is to experiment with various host logical processor settings in a lab environment to make sure that you understand the ramifications before trying this out in a production environment.
According to several reports, eBay may be port scanning visitors to its site. While this…
Microsoft has rebranded various products in its Office 365 lineup as Microsoft 365. Here is…
In this second article in our series, we will work on the Ansible Automation Engine…
Microsoft Build 2020 included several announcements aimed at developers and the IT community. Here are…
Using Azure Active Directory Identity Protection will boost your security. This step-by-step guide shows you…