VM vCPU allocation
-
If a host has 8 CPUs:
If running one VM will there be a difference in performance between allocating to the VM:
- 2 vCPUs
- 8 vCPUs
If running two VMs will there be a difference in performance between allocating to each VM:
- 2 vCPUs
- 4 vCPUs
- 8 vCPUs
Edit: Windows Server VMs
-
@McHenry You can allocate more vCPUs than real CPUs. If a VM is single threaded bound then adding more vCPUs won't make it faster and also won't slow down other VMs. If you allocate more vCPUs and they are all busy then all VMs will slow down because they share CPU cores.
Unless you do something special then VMs allocated vCPUs that don't use them won't really interfere with other VMs that need CPU time that share vCPUs.
Remember Dom0 also has vCPUs allocated and will share time with VMs.
-
So if a VM will only ever use the CPU resources it requires, regardless of what is allocated to it. What is the case to ever allocate less than the maximum number of vCPUs available?
-
@McHenry
Differences could be things such as:- Amount of cores between hosts for migrations
- Guarantee performance between guests. So that they don't affect each other as much.
Same with overprovisioning dynamic RAM
-
What about topology?
- 1 X 8
- 2 X 4
- 4 X 2
- 8 X 1
I understand this to mean:
- With SQL Server Express 1 X 8 would be optimal
- With SQL Server Standard 4 X 2 would be optimal
Does that sound right?
-
@McHenry Minimal effect on having more sockets but less cores. Keep it simple.
If your license limits you to 1 socket and 4 cores, then 1 socket and 4 cores is what you use. 1 socket an 8 cores is greater than the 4 core limit.
For the 4 socket/24 core limit you could still use 1 socket and 24 cores (or 1 socket and 8 cores, or 2 sockets and 12 cores each, or 4 sockets and 6 cores each). But you can't use 6 sockets and 4 cores each because that's over the limit.
The math has to work out to support your system. You can't have 4 sockets and 4 cores if you only have 8 cores in your system (or threads, but then you have to look at the SMT notes about hyperthreading).
You can have more VMs with allocated cores than your system actually has (like 4 VMs with 4 cores each, on an 8 core host), but a single VM can't have more cores allocated then the host actually has (like 16 cores in a VM on an 8 core host).
I think the optimal assignment is to use the template default or the number of sockets your host has (or less) and then assign the number of cores you need. There's a whole NUMA issue that Xen tries to work out between the host and the guest. If you go into SQL optimization then you might want to pin CPUs for the VMs for best performance. If you have a single socket system then just use one socket and the number of cores you want. If you have a pool then watch out for the minimum system specs (ie. you can't migrate a 16 core VM from a 24 core host to an 8 core host).
-
Sorry, 100% confused now
In a virtualized environment, the compute capacity limit is based on the number of logical processors, not cores. The reason is that the processor architecture isn't visible to the guest applications.
https://learn.microsoft.com/en-us/sql/sql-server/compute-capacity-limits-by-edition-of-sql-server?view=sql-server-2016As I am using a Windows VM, does this mean I need to base my calculations on logical processors?
A logical processor is the number of the processor's cores multiplied by the number of threads per core.
https://www.intel.com/content/www/us/en/support/articles/000036898/processors/intel-xeon-processors.htmlXen Orchestra shows my CPU as having 15 cores whereas the Intel website shows my CPU as having 8 cores and 16 threads.
Would I be correct in concluding that the number or cores in XO equates to the number of logical processors? So the combination of sockets and cores on the VM does not matter as long as the total does not exceed the number of cores listed in the Microsoft website?
-
@McHenry Yes, XCP sees and uses all threads (8 core + SMT x2 threads = 16 logical cores). So you can assign all of them to a VM as long as the VM can use them.
XO shows 16 "cores" (total threads) and 1 socket. It also shows hyperthreading is enabled. XCP/XO does not differentiate between cores, threads, E-Cores or P-Cores.....a thread is an assignable core resource.
You can assign 16 logical vCPU that includes real cores and SMT threads.
Some programs do not work well with hyperthreading in a VM environment. So you may wish to disable SMT depending on the workload.
-