Unlike physical server running on physical CPU, whereby the common sense is more CPU (or CPU core) is better, in a virtualized environment, it is often a best practice to configure as few virtual CPU (vCPU) as possible to the virtual server.
In most cases, if 1 vCPU is sufficient, it is advisible to configure the virtual server to use 1 vCPU instead of more.
This is because:
- Each vCPU will consume some physical CPU resource even if it is in idle state.
- Unused vCPUs still consume timer interrupts unless the guest OS kernel is configured with the NO_HZ "tickless timer" option (a feature available in the latest Linux 2.6 kernel).
- The more vCPUs a virtual machine has, the more interrupts it requires.
- Maintaining a consistent memory view among multiple vCPUs can also consume additional resources, both in the guest OS and the host.
- Some older guest OS execute idle loops on unused vCPUs, thereby consuming
resources that might otherwise be available for other uses. - The guest scheduler might migrate a single-threaded workload amongst multiple vCPUs, thereby
losing cache locality. - In SMP guests the guest OS can migrate processes from one vCPU to another. This migration can incur a small CPU overhead.
Reference: Performance Best Prictice for VMWare vSphere 5.0