M
M
Michael2021-04-08 20:46:33
linux
Michael, 2021-04-08 20:46:33

How to correctly set the CPU limit for virtual machines on Proxmoxe?

Actually the question is - in the VM settings on proxmox I see that it is possible to set limits on the CPU,
1. How justified is this? There are some VMs that consume an average of 30% of 100% for several months (in statistics) - I set them 0.5 - is that correct? Wouldn't it be over-insurance?
2. I understand the principle correctly - I set it to 0.5, does this theoretically limit the CPU resource at the level of 50% of the conditional 100%?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-04-08
@happy-cat

I didn’t really understand what you put up there (or are going to), but Proxmox has a wonderful and very detailed section right in the built-in help - by pressing the Help button in the corresponding window.
Let me quote a piece:

In addition to the number of virtual cores, you can configure how much resources a VM can get in relation to the host CPU time and also in relation to other VMs. With the cpulimit (“Host CPU Time”) option you can limit how much CPU time the whole VM can use on the host. It is a floating point value representing CPU time in percent, so 1.0 is equal to 100%, 2.5 to 250% and so on. If a single process would fully use one single core it would have 100% CPU Time usage. If a VM with four cores utilizes all its cores fully it would theoretically use 400%. In reality the usage may be even a bit higher as Qemu can have additional threads for VM peripherals besides the vCPU core ones. This setting can be useful if a VM should have multiple vCPUs, as it runs a few processes in parallel, but the VM as a whole should not be able to run all vCPUs at 100% at the same time. Using a specific example: lets say we have a VM which would profit from having 8 vCPUs, but at no time all of those 8 cores should run at full load - as this would make the server so overloaded that other VMs and CTs would get to less CPU. So, we set the cpulimit limit to 4.0 (=400%). If all cores do the same heavy work they would all get 50% of a real host cores CPU time. But, if only 4 would do work they could still get almost 100% of a real core each. If all cores do the same heavy work they would all get 50% of a real host cores CPU time. But, if only 4 would do work they could still get almost 100% of a real core each. If all cores do the same heavy work they would all get 50% of a real host cores CPU time. But, if only 4 would do work they could still get almost 100% of a real core each.
The second CPU resource limiting setting, cpuunits (nowadays often called CPU shares or CPU weight), controls how much CPU time a VM gets in regards to other VMs running. It is a relative weight which defaults to 1024, if you increase this for a VM it will be prioritized by the scheduler in comparison to other VMs with lower weight. Eg, if VM 100 has set the default 1024 and VM 200 was changed to 2048, the last VM 200 would receive twice the CPU bandwidth than the first VM 100.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question