I’ve been spending more time working with virtual machines lately, and I realize I don’t actually understand the practical difference between these.
It’s reasonably obvious that the vCPU option changes the number of virtual processors presented to the guest OS. Then the cores option changes the number of cores each virtual CPU has. But is there a practical difference between one vCPU with 2 cores and two vCPUs?
It might just be dependent on the OS running in the guest being able to utilize two physical processors vs multi-core cpus? I feel like there are other implications to this difference that I’m not seeing.
it is mostly about how the hypervisor is utilized. Nutanix is KVM based, and recomends to use vCPU to set the number, even though it does support vCore as well. ProxMox, again based on KVM preferes you use vCore for most items, even though ProxMox can set vCPU vCore and vThread.
mostly the VM does not care, but be aware there may be NUMA benefits using certain settings, and some OS do have recommendations for use in a VM.
What Zedicus said, unless you are running a workload that is aware of the underlying physical mapping between virtual cpus and physical cpus then you’re much better off with 1 processor, how many vCpus are needed.
If, on the other hand, you are running tasks on a VM that has vCpus pinned to specific cores, and the cores are on more than one physical processor, then you do want to mimic he physical mapping to the virtual, mainly to optimize memory and cache access …
Again, for normal use cases/if you don’t need maximum perfromance out of your VMs (at the expense of locking/reserving physical resources) then you don’t care …
My background is primarily VMWare, but have dabbled in almost every hypervisor out there.
When you set CPU / Cores be aware that you can be spreading your VM across two or more CPU’s. IMO, it’s much better to have your VM on the same CPU, where possible. If you set two CPU and one socket, you’ll tie up two CPU’s.
Set two CPU on two cores and you will have your VM running on one CPU.
That said, in most cases, it does not matter. Licensing is a consideration, depending on the hypervisor / OS, but cores are typically better than sockets because of L3 cache. Cores on the same CPU can share L3 cache where sockets cannot. So if you have multi-thread processes that use L3 keeping vm processes on the same die will be more efficient.
In the end, talk to as many sources as you can and make up your own mind.
I am using virtualization since 2004 at the time with GSX Server 2.5 and was not forced to thing about my virtual hardware since I came across GPU passtrough and gaming with a Windows VM.
With a first generation Threadripper you are forced to map your virtual hardware exactly to the physical, NUMA and CPU cache sizes is the key to consistent frame times.
I am in the process of putting together a new system, the information I’m still missing is, are the CPU cache sizes correct for Consumer CPUs with KVM/Qemu?
What I’ve seen with others so far is that 2Level and 3 Level Cache are wrong.
I would be grateful If someone could test this, unfortunately, I don’t have a desktop CPU at hand.