Hyper-V CPU Scheduling–Part 3
Having talked about the virtual machine reserve and the virtual machine limit – the next logical stop in the discussion of how Hyper-V schedules virtual machine CPU time is relative weight.
“Relative weight” is the third processor resource control setting that you can configure. Unlike the virtual machine reserve and limit there is no unit for the relative weight. It is just a number between 1 and 10,000 – which is set to 100 by default.
The CPU relative weight does not come into effect until there is contention for CPU resource on the physical computer. This means that if you have one virtual machine with a relative weight of 100 and a second virtual machine with a relative weight of 200 – both will get all the CPU time they need if it is available. Where relative weight comes into play is if virtual machines are asking for more CPU time than is physically available.
With all virtual machines set to a relative weight of 100 (the default for Hyper-V) when there is contention for CPU resource – it will be shared evenly among the virtual machines. But if one virtual machine had a higher relative weight (e.g. 200) it would receive a higher share of the system resource.
Relative weight works well for people who want to categorize virtual machines as “important” and “not important”. The best thing about relative weight is its flexibility. If you create a new virtual machine you do not need to adjust the weighting on all of the existing virtual machines.
How do people use the CPU relative weight?
The most common reason I hear for using relative weight is when people are mixing production and development or staging environments on the same physical computer. They use relative weight to mark the production virtual machines as important – and thus ensure that as development virtual machines come and go, they do not interfere with the production systems.
What are the common problems involved in using CPU relative weight?
The common issues that I hear about with CPU relative weight are:
There are no guarantees of service
Unlike the CPU reserve and limit – relative weight provides no absolute guarantees of what level of service a virtual machine. You can guarantee that one virtual machine will receive more of less resource than other virtual machines – but you still may get less resource than you want.
You need to have a common scale for configuring relative weight
You need to ensure that everyone who configures relative weights in your environment has a common understanding of what am “important weight” is and what a “standard weight” is. For example – if you had two server administrators; and one used weights of 200 for important and 100 for standard – while the other used weights of 1000 for important and 500 for standard. Both these administrators would get the same results while their virtual machines remained on their servers. But if they ever moved a virtual machine between the systems – the foreign virtual machine would be weighted significantly higher or lower than the rest of the virtual machines on the system.
That is all I have to say for today – stay tuned for further discussion of Hyper-V CPU scheduling.
Cheers,
Ben
Comments
Anonymous
September 10, 2014
What are MS best practices for reserving physical cpus for the host operating system?Anonymous
February 22, 2016
Hi Ben, Can you confirm/deny that cpu resource provisioning (reserve, total system resources, limit, and weight) only apply to Microsoft Guest Operating Systems? We are on Hyper-V 2012 as our hyper-visor, with an assortment of VM guest OS's spanning from WinXP, Server 2003, 2008, 2012 to flavors of Linux and Mitel Standard Linux (MSL). Problem we are seeing is that the Linux VM's don't seem to behave like they are truly multi-threaded and take up entire cores instead of load balancing them across their assigned CPU's.Thanks.Ryan