Selecting the Number of vCPUs and Cores for a Virtual Machine

When creating digital machines in several hypervisors (VMWare, KVM, , and so forth.), you may even see that typically a digital machine could not see all digital processor sockets (vCPU) assigned to it. In our case, eight vCPUs had been assigned to a KVM digital machine and Windows 10 was put in on it as a visitor OS. However, Windows detected these vCPUs as separate processors (not cores) and it might use solely 2 of them.

Windows 10 Virtual Machine Using Only 2 Cores

If you open Windows Device Manager, you’ll be able to guarantee that all allotted cores are seen as eight separate digital processors QEMU Virtual CPU model 2.5+.

QEMU Virtual CPU version 2.5 multi processor virtual machine on KVM

At the identical time, Windows 10 properties (Computer -> Properties) and Task Manager present that solely 2 QEMU Virtual processors can be found.

Windows Virtual Machine Sees Only 2 processors

It signifies that Windows 10 is ready to use solely 2 cores irrespective of what number of of them you’ll add. At the identical time, a digital server working Windows Server 2016 on the identical hypervisor can see all 16 vCPUs allotted to it.

Number of Processors Supported in Windows

The drawback is that desktop Windows variations (Windows 10/eight.1/7) have a restriction on the most quantity of bodily processors (sockets) a laptop can use:

  • Windows 10 Home – 1 CPU
  • Windows 10 Professional – 2 CPU
  • Windows 10 Workstation – as much as Four CPU
  • Windows Server 2016 – as much as 64 CPU

However, this restriction shouldn’t be associated to the quantity of cores. In order to enhance the efficiency of your digital machine, you should utilize a processor with extra cores. Most hypervisors can present vCPUs as processors, processor cores and even threads. It signifies that as an alternative of eight vCPUs, you’ll be able to add 2 vCPUs (2 sockets) with Four per socket. Let’s see on tips on how to assign digital processors as cores in several hypervisors and tips on how to bind it to the NUMA structure utilized in trendy processors.

Managing Virtual Core & vCPU in KVM

In my KVM digital machine working Windows 10, all assigned digital cores are thought of as separate processors.

To use all CPU sources allotted to a digital machine, it should see one eight core processor, 2 vCPUs with Four cores every or 1 vCPU with Four cores in two threads as an alternative of eight vCPUs. Let’s attempt to change the allocation of digital cores for the KVM digital machine.

Shut down your digital machine:

# virsh shutdown w10testvm – the place w10testvm is the title of your digital machine

Here are the elements of a KVM digital machine administration from the console utilizing virsh.

Display the present XML configuration of the KVM digital machine:

# virsh dumpxml w10testvm

We want a block describing the VM CPU settings:





As you’ll be able to see, eight vCPUs are set right here. Let’s change the configuration:

# virsh edit w10testvm

Add the following block after :


  • host-passthrough is the emulation mode during which the digital machine sees the bodily processor of the cluster node
  • sockets='1' signifies that there’s one vCPU (socket)
  • cores='Four' the processor has Four cores per socket
  • threads='2' ieach core has 2 threads

Save the configuration file and begin the digital machine. Log in to the Windows 10 visitor VM, run Task Manager or Resource Monitor, and guarantee that the Windows sees all allotted digital cores.

virtual machine virtual sockets vs cores per socket

A bodily processor of the host, Intel(R) Xeon(R) Silver 4114 CPU, is now displayed as an alternative of a digital one in the system properties.

Intel(R) Xeon(R) Silver 4114 multi core CPU on virtual macnine

Here is how we managed to resolve the heavy load difficulty for the VM since two cores haven’t been sufficient for the apps to work correctly.

Setting the Number of Cores per vCPU for a VMWare VM

You can change the means of vCPU presentation for a VMWare digital machine in the vSphere Client interface.

  1. Shut the VM down and open its settings;
  2. Expand the CPU part;
  3. Change the VM configuration in order that the visitor OS can see 2 processors with Four cores every. Change the worth Cores per Socket to Four. It signifies that the visitor OS will see two Four-core CPUs (2 sockets with Four cores per socket); Changing the number of cores per CPU in a VMWare virtual machine
  4. Save the adjustments and run the VM.

Virtual Machine vCPU and NUMA Architecture

There are some extra elements of assigning vCPUs and cores to digital machines that it’s essential to perceive.

When assigning the quantity of cores per socket, be certain that whether or not you have got NUMA structure (utilized in most trendy CPUs). It shouldn’t be beneficial to assign extra cores per socket (and the whole quantity of vCPUs) to a VM than the quantity of cores accessible in your bodily socket (NUMA node). When positioned on a single bodily NUMA node, a digital machine will be capable to use quick native RAM accessible on the particular NUMA node. Otherwise, processes must wait for the response from one other NUMA node (that takes longer time).

If you assign two separate digital sockets to a VM, the hypervisor can run them on completely different NUMA nodes. It will have an effect on the VM efficiency.

If the quantity of vCPUs wanted is greater than the quantity of cores on 1 bodily socket (NUMA node), create a number of digital sockets (processors) with the needed quantity of cores. Also it’s not beneficial to make use of an odd quantity of processors (it’s higher so as to add 1 vCPU).

It permits to take care of the digital machine efficiency.

virtual machine vCPU nubmer and NUMA architecture

For instance, it is suggested to make use of the following configuration for a 2-processor host with 10 cores per socket (40 vCPUs can be found in whole together with HyperThreading) if you configure vCPUs for a VM:

vCPU Number Needed Number of Virtual Sockets in the VM Settings Number of Cores per a Virtual Processor in the VM Settings
1 1 1
10 1 10
11 Not optimum
12 2 6
20 2 10

For instance, a VM working Microsoft SQL Server 2016 Enterprise Edition with 16 vCPU (in the configuration of eight Sockets with 2 Cores per Socket) can have poorer efficiency that a VM with 2 Sockets x eight Cores per Socket.
Also keep in mind that some purposes are licensed relying on the quantity of bodily sockets (prefer it was in earlier SQL Server variations). Sometimes it’s extra worthwhile to license one multicore processor than a number of processors with the much less quantity of cores.

Check Also

Configuring L2TP/IPSec VPN Connection Behind a NAT, VPN Error Code 809

Due to disabling PPTP VPN help in iOS, one in all my shoppers determined to …

Leave a Reply

Your email address will not be published. Required fields are marked *