Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have ESX server with 8 CPUs. Can I create 4 VMs with 4 VCPUs?

share|improve this question
add comment

3 Answers 3

The best explanation I've heard for 'You should only have one vCPU per VM' is as follows:

When a VM wants a portion of processing time, it waits by the sidelines until it can put a lock on n physical CPU's, where n is the number of vCPUs the VM has. If there is only one vCPU within the VM, it only has to wait until one physical CPU is available before it can jump in and get some stuff done. If it has two or more vCPU's, it has to wait until two or more CPU's are simultaneously available before it jumps in and gets on with things (It will not lock one CPU at a time and wait for more to follow it- it has to wait for multiple to be available before it can pounce)

If you have a bunch of single-vCPU VM's thrashing the physical CPU's, and one multiple-vCPU VM wanting to process, it will possibly have to wait for quite some time as the single-vCPU VM's jump in and keep snatching away spare CPU's before the multiple-vCPU box can get a lock on the number of CPU's that it needs.

VM's lock, use and unlock CPU's rapidly, but the above behaviour can cause poor performance of multi-vCPU boxes in certain situations.

I hope that makes sense (There were a lot of CPU and vCPU and VM mentions, I hope I didn't mix anything up)

This is only heresay - my boss attended VMWare training and relayed the above story to me. It has gone from instructor to my boss to me to you, so take it as you will.

share|improve this answer
    
This is a great explanation but there is one clarification I would make. vCPU's each map onto what VMware calls a hardware execution context and multi-vCPU systems have to be able to schedule all of their hardware execution contexts concurrently. VMware treats each logical core in a multi-core physical CPU as a hardware execution context rather than the physical CPU\socket, just in case that wasn't clear. –  Helvick Nov 17 '09 at 9:34
    
This is a good explanantion but it can be put simply by stating multi-vCPU systems have to be able to schedule all of their hardware execution contexts (cpus) concurrently on the same host. If you do not have enough contexts free now they have to be swapped in and out causing performance degradation. –  Jim B Nov 17 '09 at 13:42
add comment

You can, but watch out for performance issues related to CPU scheduling.

VMware has the architectural limitations for guests and hosts well documented in their Configuration Maximums guide, located here for ESX4/vSphere, and here for ESX3.5 (direct links to PDF's).

share|improve this answer
    
thank you for the pdf's. –  grub Nov 17 '09 at 8:12
    
grub it's worth you knowing that about 40% of the VCP3 and about 25% of the VCP4 exams are derived directly from those two PDF files if you're thinking of going for it. –  Chopper3 Nov 17 '09 at 15:03
add comment

You can create n VM's with 4 vCPU's. The question is if the performance of the vm's will be good.

Best practice is just to add 1 vCPU per VM and add another vCPU if you really need one. I just have one or two VM's with 4 vCPU's.

Every VM's shares the physical CPU's of the host system. As more vCPU's you add the more time slices a VM get to work on the physical CPU. Normally you don't reserve a physical CPU only for one VM. It's possible but normally not needed.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.