VMware Cloud Community
JonRoderick
Hot Shot
Hot Shot

VM vCPU resource capping - why would I do this?

Why would I want to cap the resources available to a VM via the vCPU (i.e. setting limits on the GHz it can actually use).

If I have a VM running on a 3.0GHz vCPU and I cap it to 2.0GHz, the vCPU still has to be scheduled for the same length of time (probably longer with the reduced speed) so there's no benefit there.

If you're capping CPU, what are your drivers for doing it?

Cheers

Jon

0 Kudos
5 Replies
madda
Hot Shot
Hot Shot

It is useful for instance if you have application on a VM which you know thrashes the vCPU to 100% for 5minutes. If you set an upper limit on the vCPU to 80% then there is still 20% of CPU resources available for other VMs.

If you let that VM take 100% CPU time for a period of time without limits then other VMs on that host would suffer with regards to performance, and the CPU wait time would increase

----- Mark Atherton
0 Kudos
JonRoderick
Hot Shot
Hot Shot

Ok, thanks. That suggests that when the hungry VM is thrashing that 80% CPU, other VMs can make use of the available 20% - my understanding is that the physical CPU is scheduled in its entirety - not in % chunks so that regardless of whether the hungry VM is using 80% or 30%, no other VM/vCPUs can be scheduled to run on that physical CPU at the same time.

If I've got this wrong, let me know - but be gentle!

Cheers

0 Kudos
madda
Hot Shot
Hot Shot

Ok, I as over simplifying things. You are correct only 1 VM can use a CPU at one time. When you setup resource allocation it tweaks the shares value. You probably understand that every few milliseconds ESX checks the current work load on the server and see's if another VM needs to use the CPU, if another VM does then the one with the higher share value has a higher chance of using that CPU.

When you setup an 80% max for a vCPU then you are lowering that shares value, which increases the availability of the CPUs to other VMs.

I'm not great at explaining things, but hopefully that makes sense

----- Mark Atherton
0 Kudos
JonRoderick
Hot Shot
Hot Shot

Thanks Madda

I'm not sure I'm seeing this in practice - when I cap the CPU allocation in 1 VM but leave it uncapped in another 2 (identical VMs on the same host) - the shares value doesn't change in the VI Client.

The link between CPU allocation and shares doesn't really add up either - sorry to doubt what you're saying but I'm not seeing evidence to support it.

Can you add anything to convince me?

Cheers

Message was edited by: JonRoderick

BTW, I understand the shares but just not how capping the CPU affects shares.

0 Kudos
madda
Hot Shot
Hot Shot

I couldn't find an up-to-date PDF for this at the moment, but have a look at this http://www.repton.co.uk/newsletter/repton_pages/docs/esx2_cpu_performance.pdf and scroll down to Limit CPU Resources using Maximums.

It should give you a reasonable idea about it

There is a CPU Performance Tuning PDF for ESX 3 here too which might be helpful as well http://www.vmware.com/pdf/vi_performance_tuning.pdf

----- Mark Atherton
0 Kudos