Dynamic CPU cores allocation

ionutr

New Member
Jul 5, 2021
2
0
1
35
Hey,

I was wondering if it's possible to dynamically allocate CPU cores to VMs.
ex: having 4 VMs on a 24 core CPU (6 cores each) and when 3 of the VMs are idling, to re-allocate the unused cores to the 4 VM that has a big load running on it.

Thanks :)
 
Last edited:
That already happens, automatically. What you're referring to is called "overprovisioning", i.e. you assign more cores to your VMs than you physically have. Then, when a VM isn't using some of it's cores, the performance will be available to others.

In your example, you could assign your 4 VMs 20 cores each, then, if 3 are idle, the 4th will get access to all 20 cores, if all 4 are busy, every VM will get the equivalent of 24/4 = 6 cores. This of course will not show up in a reduced core number, but in overall reduced performance, i.e. the guests will see 20 "slower" cores - but the effect is the same.

There is a limit as to how much you should overprovision of course, at some point your host itself will be overloaded which may cause further issues.
 
This solution does not seem like a good idea if using Ceph, because if Ceph does not have CPU resources available that it wants then all kind of error happen. Is this still the suggested way to dynamically allocate CPU cores?