VM resource usage
-
I have a host with 48 CPUs and 96GB RAM
I understand that the RAM cannot be over allocated to VMs or I get the no hosts available message a startup however I understand CPUs can, so I could allocate all VMs 48 CPUs and they will only utilise what they require. Is this correct and if so is there any reason not to allocate the max CPUs to a VM.
Further to this, if I only allocate the VMs a smaller number of CPUs do they all overlap on the first X CPUs and leave the others unused. i.e. if VM1 has 8 then it will only use the 1st 8 and if VM2 has 4 then it will only use the first 4.
I ask as I currently have multiple VMs using a lesser number of CPUs than the host has however the status only show the first 15 CPUs in use on the host:
-
Hi,
A vCPU is scheduled by Xen "like" a process/thread on your operating system is scheduled.
If a VM got 48x vCPUs, it will be scheduled across all the 48 physical cores. But if other VMs are also using the same vCPU number, the scheduler will have to prioritize, and more work for the scheduler, more wait inside your VMs (because the scheduler will have to give access to a physical core for one VM and then put another one on it, and so on)
A rule of thumb:
- Less vCPU than physical cores: no wait possible (more or less the time to schedule, but it's very small)
- Same number: almost no wait
- More vCPUs than physical cores: depending on your VM load, you could have more wait. 2:1 or 4:1 ratio are OK for relatively small average load OR non-concurrent load. If all VMs are using all CPUs, as soon as you go beyond physical number of cores, you WILL have an impact on waiting for CPUs.
-
@McHenry like @olivierlambert said, keep in mind that a VM with 16 CPUs will be less available than a VM with 4 vCPUs, because it's easier to have 4 vCPUs ready to work than 16 simultaneously
beware of this graph, it only graph the first 16 vCPU, but you can have more working !
the visual widget is failing you.think of topology too : if you have two sockets, you can have a topology of 2 sockets with 4 cores for a 8 vCPU VM.
If you have only one socket, try to keep the topology to "1 socket xx cores" for your VMs, performance wise.