VM's (any) should you set processors / cores to same as host


  1. Posts : 11,247
    Windows / Linux : Arch Linux
       #1

    VM's (any) should you set processors / cores to same as host


    Hi folks
    Whatever software you use for your VM's - is there any advantage in setting the virtual vCPU to having less cores / threads / processors than the Host.

    AFAIK if a VM is idle it isn't consuming any host resources so the best way to run it as far as I can see is to give it the resources it needs rather than try and run it in "Starvation Mode".

    @Kari

    I assume this is true also if you run in HYPER-V . It seems (at least for me) to be quite difficult to get real dynamic details of resources a VM uses once you've sorted out RAM and I/O systems.

    I've found though intuitively running VM's (at least with VMware) with the vCPU set to same number of processors / cores / threads as the Host and always assuming sufficient RAM and proper disk I/O they run better - especially when loaded quite heavily using the VM config parameters set that way rather than minimising to default vCPU options.

    Any real "Geeky" opinions here =-- I'm actually quite interested in this topic if people have time.

    Cheers
    jimbo
      My Computer


  2. Posts : 50,055
    Windows 10 Home 64bit 21H1 and insider builds
       #2

    jimbo45 said:
    Hi folks
    Whatever software you use for your VM's - is there any advantage in setting the virtual vCPU to having less cores / threads / processors than the Host.

    AFAIK if a VM is idle it isn't consuming any host resources so the best way to run it as far as I can see is to give it the resources it needs rather than try and run it in "Starvation Mode".

    @Kari

    I assume this is true also if you run in HYPER-V . It seems (at least for me) to be quite difficult to get real dynamic details of resources a VM uses once you've sorted out RAM and I/O systems.

    I've found though intuitively running VM's (at least with VMware) with the vCPU set to same number of processors / cores / threads as the Host and always assuming sufficient RAM and proper disk I/O they run better - especially when loaded quite heavily using the VM config parameters set that way rather than minimising to default vCPU options.

    Any real "Geeky" opinions here =-- I'm actually quite interested in this topic if people have time.

    Cheers
    jimbo
    In VBox they recommend no more than half the cores in the host, any more is flagged as an invalid setting.


    Edit: That may be incorrect. They say not to set it above the number of physical cores with no hyperthreading.
    Last edited by kado897; 01 Apr 2019 at 13:53.
      My Computer


  3. Posts : 17,661
    Windows 10 Pro
       #3

    I only know Hyper-V, so the following applies to it, but might apply to other virtualization platforms, too.

    By default, a Hyper-V VM supports one virtual processor (vCPU) per host CPU core. On this main workhorse of mine, an i7 laptop with 8 cores, the maximum vCPU count on single VM is 8.

    However, as each host CPU core can support 8 vCPUs, I could have 8 virtual machines running at the same time with 8 vCPU each (8 host cores * 8 supported vCPUs per host CPU core = 64), or 64 virtual machines running at the same time each with one vCPU, subject to other resources on host like amount of RAM allowing it.

    A vCPU on a VM can only be used when matching thread on host CPU core is idle. This means that using the max amount of vCPUs, the VM can in fact be quite slow because its vCPUs must always wait that the thread on matching host CPU core is idle. According to my experience, the optimal host CPU core - VM vCPU ratio is 2:1, one vCPU per two host CPU cores when running multiple virtual machines at the same time. If only ever running one VM at any given time, my recommendation is to use 1:1 ratio, one vCPU per one host CPU core.

    In this post I show the difference between 2 and 8 vCPUs: Hyper-V and Windows 10 Guest speed - Windows 10 Forums

    Kari
      My Computer


  4. Posts : 11,247
    Windows / Linux : Arch Linux
    Thread Starter
       #4

    Kari said:
    I only know Hyper-V, so the following applies to it, but might apply to other virtualization platforms, too.

    By default, a Hyper-V VM supports one virtual processor (vCPU) per host CPU core. On this main workhorse of mine, an i7 laptop with 8 cores, the maximum vCPU count on single VM is 8.

    However, as each host CPU core can support 8 vCPUs, I could have 8 virtual machines running at the same time with 8 vCPU each (8 host cores * 8 supported vCPUs per host CPU core = 64), or 64 virtual machines running at the same time each with one vCPU, subject to other resources on host like amount of RAM allowing it.

    A vCPU on a VM can only be used when matching thread on host CPU core is idle. This means that using the max amount of vCPUs, the VM can in fact be quite slow because its vCPUs must always wait that the thread on matching host CPU core is idle. According to my experience, the optimal host CPU core - VM vCPU ratio is 2:1, one vCPU per two host CPU cores when running multiple virtual machines at the same time. If only ever running one VM at any given time, my recommendation is to use 1:1 ratio, one vCPU per one host CPU core.

    In this post I show the difference between 2 and 8 vCPUs: Hyper-V and Windows 10 Guest speed - Windows 10 Forums

    Kari
    Hi there
    @Kari
    Thanks

    Great explanation - I've set it back to the suggested ratio. In my case though when testing the VM the Host is usually quite idle ---playing / serving music from the HOST isn't the most demanding of tasks for a machine.

    Cheers
    jimbo
      My Computer


  5. Posts : 7
    Win10
       #5

    Kari said:
    <snip>
    However, as each host CPU core can support 8 vCPUs
    <snip>

    Kari
    What is your source for this information?

    Maybe it's miscommunication, but this is not correct. The total number of vCPU cores is not limited by physical CPU cores. With the latest release of Hyper-V, it is 2048 virtual processors per host. It's the same whether you have an entry level dual core Pentium processor or quad 20+ core Xeon's. Within a single virtual machine you are limited to 1:1 vCPU to real logical CPU, up to 64, but at the host the limit is 2048.

    The reason to minimize the number of vCPU is that each virtual processor adds some overhead. Each vCPU consumes some memory, and running more threads than logical cores adds processing overhead.
      My Computer


  6. Posts : 17,661
    Windows 10 Pro
       #6

    owdi said:
    What is your source for this information?

    Maybe it's miscommunication, but this is not correct. The total number of vCPU cores is not limited by physical CPU cores. With the latest release of Hyper-V, it is 2048 virtual processors per host. It's the same whether you have an entry level dual core Pentium processor or quad 20+ core Xeon's. Within a single virtual machine you are limited to 1:1 vCPU to real logical CPU, up to 64, but at the host the limit is 2048.

    The reason to minimize the number of vCPU is that each virtual processor adds some overhead. Each vCPU consumes some memory, and running more threads than logical cores adds processing overhead.
    My information was based on this old Microsoft TechNet Q&A session (highlighted sentence in quote):

    vCPU vs CPU

    Q: So, 4 vCPUs are not equal to 4 CPUs of host. If I assign 4 vCPUs to the VM, it certainly will not affect host?
    So, can we say one vCPU is equal to one logical processor of physical host? (ex: one Quad processor = 8 logical processor)?

    A: When dealing with hypervisors it is easier to think in cores and virtual processors than it is to think in cores, logical processors, and virtual processors.

    In reality what really matters is cores and virtual processors. Each core very safely support 8 virtual processors. Logical processors are abstractions of time of the physical processors and really muddy the thinking as they apply to a physical machine one way and to a hypervisor in a different way.

    Can you go beyond this number? Oh, yes. Very easily - and as long as you don't have CPU intensive virtual machines you can do it safely as well.
    Hyper-V Concepts: vCPU (Virtual Processor) - QA - TechNet Articles - United States (English) - TechNet Wiki

    Hyper-V has, as far as I know, always supported more than 8 vCPUs per host core, but equally, that wording "very safely support" is still a good rule of thumb which I follow and recommend.

    My apologies for wrong information.

    Kari
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:47.
Find Us




Windows 10 Forums