Virtualization: Should I assign CPU’s or Cores

TL:DR Cores Cores Cores (but no more than pCPU count)

When creating a new virtual machine in VMware ESXi or VMware Workstation, it asks you how may processor cores you wish to set and gives you the option to set both ‘Number of processors‘ and ‘Number of cores per processor‘.

Most places online (looking at you Stack Overflow) said that only ‘Total processor cores‘ matters. I was curious as to how true that was and decided to run some tests myself.

The results are as follows

CPU’s Cores Single-Core Score Multi-Core Score % Increase
1 1  3159  2976  base
1 2  3161  4758  ↑60%
1 4  3055  5068  ↑70%
2 1  2991  4820  ↑62%
4 1  2960  4931  ↑65%
2 2  2913  5060  ↑70%

The results here were pretty astonishing, as soon as we increase the CPU count we actually lost single-core performance and gained a slightly higher multi-core score.

This may be because of the way VMware handle cores vs CPU’s. It could also be because of how the guest operating system handles multiple processors. Regardless, seeing as single-thread performance is more important in most applications, I’d stick with adding cores and not processors for the time being.

How many cores to assign to vmware virtual machines

TL:DR Even with Hyperthreading enabled, do not exceed the amount of PHYSICAL cores your machine has. 

The General rule for assigning CPU’s is to keep your virtual cpu count at or lower than your physical cpu count. (VMware blog) .

I was curious as to why this was, seeing as generally one can get anywhere between a 10-30% increase in performance with hyperthreading.

To see how the performance scaled with each additional core, I decided to test it out on my laptop (1CPU, 2 Cores, 4ht cores). I spun up a new CentOS 7 machine and ran geekbench4 on each core configuration. The results were as follows

CPU’s Cores Single-Core Score Multi-Core Score % Increase
1 1  3159  2976  n/a
1 2  3161  4758  ↑60%
1 3  3109  4851  ↑2%
1 4  3055  5068  ↑4%

From our table we can see that after we arrived at the physical CPU count, adding extra cores gave us very little in terms of a performance boost.