Today’s post will cover the processor configuration available in Windows Server Hyper-V.
As you already know up to this point in time, we cannot add or remove Virtual Processor (vCPU) while the virtual machine is running. This has been the case since Hyper-V was released back in October 2008.
If we look at a regular virtual machine, we can see that the number of virtual processors is grayed out while the VM is running:
What we can do, we can reserve a number of resources for this virtual machine.
For example: always make sure at least 25% of a single processor core is reserved for this VM.
The next cool option is the Virtual machine limit (percentage).
Notice what is showing in the Percent total system resources, what amount is that the overall system resource of the Hyper-V box.
This VM has a single processor with 6% of total system resources because the physical host effectively has 16 logical processors.
So 1 Processor over 16 is equal to 6% of the overall system.
What a nice thing we can actually do, we can change these limits while the VM is running as shown in the figure below.
One thing we can do, let’s say for example to this Virtual Machine I wanted it to only have 2 processors normally.
But could be this extreme scenario where I want to access 4 vCPUs while the VM is running, how…? No magic :)
We just give it 4 virtual processors, there is no real disadvantage in Hyper-V because it doesn’t use gain scheduling in the processor like VMware, no problem to give it more virtual processors.
So 4 vCPUs with a 100% limit equal to 25% of total system resources…
However, we want actually to limit that to 50%, so effectively now is giving 2 cores worth of processing, and this is all that we would be allowing for the VM to be used.
If it’s a busy time, I want to effectively hot/add some additional CPU resources, we could increase that limit maybe to 3 cores worth @ 75% or access all 4 @ 100%.
Those actually can be changed while the Virtual Machine is running… !!!
The final option is the Relative weight is really used in times of contention.
The Relative weight really controls how much CPU time I can get compare to other virtual machines.
So suppose this VM has a Relative weight of 100 and another virtual machine for example has a relative weight of 200.
The one with 200 will get twice as many CPU cycles like the one with 100.
This lets us balance which VM is more important than others.
Some key points to note:
The rule of thumb when allocating CPUs to a Virtual Machine as best practice is to allocate 1 virtual Processor and then test the CPU utilization.
Microsoft products that should be considered for multiple vCPU’s:
1) Exchange Server.
2) SQL Server.
3) SharePoint Server.
4) Lync Server.
5) Remote Desktop Services Infrastructure.
Hopefully, Microsoft will add this feature in the next release of Hyper-V (add/remove Virtual Processors on the fly).
Enjoy your day!