CPU allocation for VMs on ESXi

cpu-usagevmware-esxi

I'm a complete VMware know-nothing, but I recently set up 4 VMs on ESXi. 3 of the VMs are very non-resource-intensive (a lightly used file server, a lightly used domain domain controller, and a VMware vMA host), and one is more resource intensive (a terminal server used by a dozen people in my small office).

The terminal server VM has been running quite slowly during peak hours. Taking a look at the performance summary in vSphere, it does seem that the CPU has been spiking above 90% quite a bit, My disk latency graph has some spikes in it too, occasionally going up to 500ms or so.

I have not configured any of the resource allocation settings in VMware, and always assumed that it would be smart enough to allow busier VMs to use available resources when less busy VMs didn't need them. It appears that this isn't the case, though, because the CPU chart for the overall server never spikes above 10%, and the disk latency never goes above 4ms or so.

So that tells me that perhaps I need to configure some of the resource allocation stuff in VMware, but I don't quite understand what I should configure in this situation. Should I increase the number of vCPUs or configure processor affinity? Or should I use the shares or reservation features? Essentially, I don't want to completely starve the other VMs of resources, but I do want the terminal server to be able to use the system resources that appear to be available.

Thanks in advance for any guidance.

Best Answer

In ESXi a vCPU will be mapped to a core on a real CPU core for computation. This means that a VM configured with 1 vCPU on a system with 4 cores can never use more than around 1/4th of the capacity of the system. Generally speaking, you do not want to configure VM's with too many vCPU's (as additional vCPU's adds overhead), nor too few (as you can not use the full capacity of the hardware).

For such a simple scenario as you describe you should not have to mess around with the resource allocation system or processor affinity. By default ESXi uses a system which assigns a fair share of resources to each vm, where configured resources are used to calculate how many shares a VM get. So you don't really have to worry about starvation.

There is a lot to learn about performance in ESXi, but I would recommend starting with reading through the best practices if you want to know how to configure the system for reasonable performance.

Related Topic