For the longest time I would not allow people to power on virtual machines with more than one CPU without proving to me they needed more than one virtual cpu. This is due to strict co-scheduling in vmware. Over the years they have relaxed this a lot. Making multiple CPU virtual machines a lot more possible. To understand the issue take a look at the following diagram:
The assumption of this diagram is rather silly but it helps me explain the problem. It is important to take into account that this diagram assumes that both virtual processors require 100% of the physical CPU. As such they have to share it. This problem is not too bad. This is known as co-scheduling on the virtual CPU. In vsphere 4 you did co-scheduling at the virtual machine level; meaning this 2 vCPU vm could not run on a single core single socket physical system. Because both vCPU’s had to be scheduled to run at the same time. Since Vmware 5 now schedules per vCPU we have a lot more flexability. The co-stop allows us to get reasonable performance on each vCPU.
It is critical to understand that adding more vCPU’s may not always provide better performance. If there is any contention for cpu’s then you will have the co-stoping practice enacted. Causing slow downs. You can monitor this in esxtop with the following settings:
- Press c for cpu
- Press upper case V to see per virtual machine
The key fields here are:
- %USED – (CPU Used time) % of cpu used at current time. This number is represented by 100 X Number_of_vCPU’s so if you have 4 vCPU’s and your %USED shows 100 then you are using 100% of one cpu or 25% of four cpu’s.
- %RDY – (Ready) % of time a vCPU was ready to be scheduled on a physical processor but could not be due to contention. You do not want this above 10% and should look into anything above 5%.
- %CSTP – (Co-Stop) % in time a vCPU is stopped waiting for access to physical CPU high numbers here represent problems. You do not want this above 5%
- %MLMTD – (Max Limited) % of time vmware was ready to run but was not scheduled due to CPU Limit set (you have a limit setting)
- %SWPWT – (Swap Wait) – Current page is swaped out