All of my ESX hosts (a mix of 3.5 and 4x) have dual quad-core processors. I had a request today to bump a VM from 1vcpu to 4vcpu.
What's the best practice for increasing the number of virtual processors comparted to physical processors and/or cores? I had thought that with only two physical processors, I shouldn't go higher than 2vcpu.
Point 1: Always remember that if you assign multiple vCPUs (say 2 or 4) to a vm - the resource management in the kernel will always have to wait for the same amount (2 or 4) consecutive physical cores to become available every time the VM needs to do something - you can get a slight lag if the vm has to wait to be allocated cpu time
Point 2: Depending on the application installed to the vm, some applications will not make use of the additional vCPU anyway (i.e. if the application isn't designed to multi-thread). I realise most applications these days are compiled on SDKs that are thread-aware, but there are still some that dont utilise the extra grunt.
Point 3: After you add the extra vCPU/s, always check the Device Manager (if the VM is a windows box) to ensure that the Machine Type changes from Uniprocessor to Multiprocessor. If it doesn't you will need to remove/delete the Uniprocessor defined type (or change it to Multiprocessor) and reboot the VM
As far as physical to virtual cores, some VMware and vendor tests are touting as many as 20:1 (vCPU to physical core) ratios... best practice is likely no more than 5:1 (five vCPUs max to each physical core) - I run on not more than 4:1 in my prod environments.
Would I run a 4vCPU machine on a dual-proc quad-core?... probably not. I think the potential for lag probably outweighs the potential for benefit.
A 2vCPU - yes... but monitor performance. If you can see no real change or benefit from within the VM from adding the second vCPU then remove it - but if you see an improvement then all good. If you need better performance give the 2vCPUs a reservation and possibly higher shares value - i.e. increase their priority over some of the lesser-important VMs to ensure the resource scheduler gives them priority.
Hope this helps
Point 1) This is no longer true - ESX 4 (and to a lesser extend 3.5) supports relaxed coscheduling, where it wont wait for both to become available.
That being said, the rest of the recommendations I agree with. Just watch your performance and CPU Ready times.
VCP, vExpert, Unix Geek
I believe relaxed co-scheduling still needs 4vCpus to be available on the instruction request (so there is still a slight delay), but it releases the unsused vCpus as soon as it determines they are not required
As such, 4vCpus is still likely to slow things down.
Unless the person requesting the 4vCPUs has an app that actually requires uit . . I would steer them away from using it.
(If you're really mean, give them 4 vCPUs, plenty power . . .and simply set a limit on it that they don;t know about) - convince them that 4vCPUs is causing bad performance (as it will affect the rest of your environemtn anyway)