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

  1. jimbo45's Avatar
    Posts : 6,897
    Windows / Linux : Centos, Ubuntu, OpenSuse
       #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 ComputerSystem Spec

  2. kado897's Avatar
    Posts : 25,164
    Windows 10 Home 64bit
       #2

    jimbo45 said: View Post
    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; 3 Weeks Ago at 13:53.
      My ComputerSystem Spec

  3. Kari's Avatar
    Posts : 15,803
    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 ComputerSystem Spec

  4. jimbo45's Avatar
    Posts : 6,897
    Windows / Linux : Centos, Ubuntu, OpenSuse
    Thread Starter
       #4

    Kari said: View Post
    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 ComputerSystem Spec

  5.    #5

    Kari said: View Post
    <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 ComputerSystem Spec

  6. Kari's Avatar
    Posts : 15,803
    Windows 10 Pro
       #6

    owdi said: View Post
    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 ComputerSystem Spec


 

Related Threads
For the past couple of days my laptop (ASUS X750JA with Intel Core i7 4700HQ @ 2.40 GHz + 6GB RAM, running 64-bit Windows 10) has been very sluggish, with newly opened windows often showing the 'Not Responding' message. On the Task Manager...
Hi there I can't quite work out whether I should assign 2 cores out of a 4 core processor (AMD OPTERON X3421 APU} to a VM running a fairly intensive DB system (MiniSAP or SAP ABAP 7.50 minisap) which has to run on a Linux machine - so I've got it...
In this months Maximum PC magazine they ran an article which calls into question whether the old adage that a gaming PC needs a Core i5 minimum. The theory has been that you need at least 4 cores and anything less powerful and you will be in a...
I was trying to enter a new host file on one of our remote user’s laptop and when I went to open the file it showed a bunch of Chinese symbols and wouldn’t let me do anything with it? I tried deleting it and then tried to build a new host file from...
My amd fx-4350 is running on 2 cores in Drivers and Hardware
I noticed that my computer is running on two cores instead of 4. https://gyazo.com/f1d7403963d19885971fbe6836470df7 My computer specs are: Asus m5a97 R2.0 Amd fx-4350 Nvidia gtx760 8gb Kingston hyperx.
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 19:11.
Find Us