Giving minimum dedicated CPU and RAM to KVM and Containers

torontob

Renowned Member
Oct 18, 2010
48
0
71
I have a server with two Intel E5620 CPUs. On the gui in summary it shows CPU(s)8 x Intel(R) Xeon(R) CPU E5620 @ 2.40GHz (2 Sockets).

When I make containers I am assigning 4 CPUs to each container, and I have about 50 containers. I also have some KVMs, and I assign them 8 CPU cores each.

1- How does Proxmox allocate CPU resources if my KVM needs more CPU, or if my
containers need more CPU?

2. Is there any way I can make sure that my containers get priority over the KVM when it comes to CPU resources or vice versa?

3- Is there a way to give it a LXC container or a KVM a minimum of available CPU resource or RAM resource?

Thanks,
 
1- How does Proxmox allocate CPU resources if my KVM needs more CPU, or if my
containers need more CPU?

KVM uses the number of cpus threads/processes and LXC are processes, so the ordinary operating system scheduler will schedule the processes. If you have more processes that require 100% CPU/core/thread usage than actual ones available, they're getting time shared, as in very non-realtime operating system.

2. Is there any way I can make sure that my containers get priority over the KVM when it comes to CPU resources or vice versa?

You can weight vms/container within their domain, but as fast as I know not across domains with the GUI. You can create cgroups if you want or renice the processes, but this cannot be done via the PVE GUI.

3- Is there a way to give it a LXC container or a KVM a minimum of available CPU resource or RAM resource?

As with your first question. This is scheduler and memory management related and Linux itself manages this. It uses everything as it needs it. So if a part of the memory was not used a while and the memory is needed elsewhere, the dormant stuff will get swapped out.

It's best to read about linux process scheduling and memory management to understand what's going on under the hood.