Following my previous post regarding slow performance of virtual machines on ESX, where I pointed out too much swapping of the COS.
This time let’s have a look at the processors and the time VMs spend on iowait and %RDY.
Putty in your ESX host and start with the TOP command, output may look like this:
CPU states: cpu user nice system irq softirq iowait idle
total 0.4% 0.0% 1.0% 0.0% 1.4% 5.4% 91.8%
5.4% is not that bad, more than 10% you have what we call a CPU contention. That is too many vCPU trying to get hold on the pCPU!
Let’s have a look at the VMs now with the ESXTOP command, output may look like this:
ID GID NAME NWLD %USED %RUN %SYS %WAIT %RDY
290 290 Test65 7 8.35 8.32 0.06 628.19 1.83
318 318 Testt66 7 91.96 92.68 0.01 543.92 1.73
260 260 Test67 7 2.55 2.54 0.02 635.31 0.50
Total of the %RDY is 4.06%, no big deal but again more than 10% and you may suffer a CPU contention problem.
Now how to fix it?
First check your ratio of number of VMs per core, no more than 5.0:1 would be a good rule of thumb
Next check vCPU allocated to your VMs, 1vCPU should be the prefered choice, assign 2vCPU if the application running on that VM really benefits from it.
You should really avoid more than 2vCPU especially if you don’t have DRS in you VMware environment.
So if you suffer from CPU Contention, lowering the number of vCPU allocated to the VMs is the first thing to do.