Mark Minasi's Tech Forum
Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Pieter

Avatar / Picture

Senior Member
Registered:
Posts: 216
Reply with quote  #1 

Are these statements about Hyper-V and virtual CPU's correct ?

1. It is possible to overcommit vCPU's.
2. If the host has 16 cores and the VM is allocated 4 vCPU's that does not mean the VM gets 4 physical cores.
3. If there are only 2 VM's and they both are allocated 3 vCPU's, that means they both will be served equally the same amount of time by the physical CPU('s) : 50-50 % ratio.
4. If there are only 2 VM's and one is assigned 3 vCPU's and the other 6 vCPU's, that means the first one will get half as much physical CPU time as the second one : 1/3 - 2/3 ratio.
5. On a host with 16 cores and two VM's, if the two VM's are both allocated 20 vCPU's, that means they both will be served equally the same amount time by the physical CPU : 50-50 % ratio.

Conclusion: vCPU assigned is relative to all the other VM's on the host.


__________________
Pieter Demeulemeester
0
cj_berlin

Avatar / Picture

Senior Member
Registered:
Posts: 288
Reply with quote  #2 
Quote:
Originally Posted by Pieter

Are these statements about Hyper-V and virtual CPU's correct ?

1. It is possible to overcommit vCPU's.


Yes. But not in the sense you formulated in your Question #5 [wink]

Quote:
Originally Posted by Pieter

2. If the host has 16 cores and the VM is allocated 4 vCPU's that does not mean the VM gets 4 physical cores.

Depends on your definition of "get". Every time the VM is given CPU at all, it can exclusively utilize 4 physical cores. Those cores are not assigned to the VM all of the time, unless you make a 100% reservation. For exactly how long the cores are given to that particular VM, depends on the total number of vCPUs assigned to running VMs on the host.


Quote:
Originally Posted by Pieter

3. If there are only 2 VM's and they both are allocated 3 vCPU's, that means they both will be served equally the same amount of time by the physical CPU('s) : 50-50 % ratio.

If you allocate 2x3vCPUs on a host with 16 cores and there aren't any other VMs running on that host, you can safely assume that each VM will have access to 3 cores all of the time.

If the host is CPU constrained due to other VMs running on it, then yes, VMs with equal vCPU counts are going to get equal time shares.

Quote:
Originally Posted by Pieter

4. If there are only 2 VM's and one is assigned 3 vCPU's and the other 6 vCPU's, that means the first one will get half as much physical CPU time as the second one : 1/3 - 2/3 ratio.

Again, if the host is not CPU constrained, both VMs can use their respective CPU cores 100% of the time. If it is, however, you cannot assume that a VM with more vCPUs will get a higher time share. Every VM will remain in waiting state until the required number of cores can be assigned to it at the same time. Then the scheduler will let it use those cores for <however long> and then reassign them.

Quote:
Originally Posted by Pieter

5. On a host with 16 cores and two VM's, if the two VM's are both allocated 20 vCPU's, that means they both will be served equally the same amount time by the physical CPU : 50-50 % ratio.


No, none of those VMs will be able to start if it has more vCPUs than the host has cores. If by "both are allocated 20" you mean "each is allocated 10" then yes, 50-50 is correct. The game changes somewhat if you take NUMA topology into consideration but for the sake of this thread we can forget about that.

Quote:
Originally Posted by Pieter

Conclusion: vCPU assigned is relative to all the other VM's on the host.


It is "sort of correct" if the host is CPU constrained, i.e. if you indeed overcommit. If it is not, every VM can use its respective cores 100% of the time.

__________________
Evgenij Smirnov

My personal blog (German): http://www.it-pro-berlin.de/
My stuff on PSGallery: https://www.powershellgallery.com/profiles/it-pro-berlin.de/
0
Pieter

Avatar / Picture

Senior Member
Registered:
Posts: 216
Reply with quote  #3 

Thanks you very much Evgenij.
 
So, if I may resume :

6. It is possible to overcommit virtual CPU's, but per VM not more than the amount of physical cores.
On a host with 16 physical cores : 2 VM's with each 16 vCPU's is possible, but 1 VM with 17 vCPU's is not possible.

7. On a host with 16 physical cores and 2 VM's with each 5 vCPU's, both VM's gets 5 physical cores. The remaining 6 cores are not used by the VM's.

8. As long as the sum of all vCPU's of all the VM's together are not more than the amount of physical cores, each VM gets as much physical cores as defined by the vCPU.

9. If the sum of all vCPU's of all VM's together is more than the amount of physical cores, than CPU load is devided proportionally.

10. Evgenij, you rocks !



__________________
Pieter Demeulemeester
0
wobble_wobble

Avatar / Picture

Associate Troublemaker Apprentice
Registered:
Posts: 889
Reply with quote  #4 
6. True
7. May not be true. Hyper-V uses lazy scheduling and may leave the VM the cores or move them.
8. See 7, but yes.
9. Yes, thay ars given slots. But also see 7.
10. Yes, hes a great source of info and friendship.

__________________
Have you tried turning it off and walking away? The next person can fix it!

New to the forum? Read this
0
Pieter

Avatar / Picture

Senior Member
Registered:
Posts: 216
Reply with quote  #5 
Thanks for the reply Joe, but I don't understand what you mean by "Hyper-V uses lazy scheduling and may leave the VM the cores or move them."  Probably a lack of my knowledge of English.
Can you clarify please ?

__________________
Pieter Demeulemeester
0
dennis-360ict

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 68
Reply with quote  #6 
Excellent explaination! Just my 2 cents about hyperthreading: We've seen some odd behaviour between OS versions. Win12 Hyper-v showed us different behaviour than Win12R2.

A collegue did a blog post at our site about it:
https://www.360ict.nl/blog/use-hyper-threading-with-hyperv/

__________________
-----
Home is where is sleep
0
wobble_wobble

Avatar / Picture

Associate Troublemaker Apprentice
Registered:
Posts: 889
Reply with quote  #7 
Sorry for the delay. Was off and turned computer off as well.
Scheduling for a process is one of the hard things to do in virtualisation. VMware do it old school (or did up to version 6) so when a guest was asked by the supervisor how many cores it needed for the next cycle, VMware waits until it has 2 or 3 or 20 CPU for the guest leading to a wait time.
Hyper-V on the other hand allows for the CPU to be used as and when they are free, reducing wait time.
I was told this a while ago by a Microsoft employee when going through a competitive analysis of VMware versus Hyper-V and have never had a reason to look further into it.

How does this effect your answer...
Well the hypervisor scheduled has the ability in Byper-V to assign whichever core it had free to your process.
So in a 20 core host and a 4 core guest your machine could potentially use all of the cores in a small window of time.

__________________
Have you tried turning it off and walking away? The next person can fix it!

New to the forum? Read this
0
Pieter

Avatar / Picture

Senior Member
Registered:
Posts: 216
Reply with quote  #8 
thanks for the clarification Joe, your feedback is very much appreciated.
__________________
Pieter Demeulemeester
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.