Revisiting CPU limit for LXC 2.0 / LXD

gkovacs

Renowned Member
Dec 22, 2008
512
50
93
Budapest, Hungary
Upon reading the LXD / LXC 2.0 documentation, I have come across some new CPU limit features on this page:
https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/

CPU
When it comes to CPU limits, we support 4 different things:
  • Just give me X CPUs
    In this mode, you let LXD pick a bunch of cores for you and then load-balance things as more containers and CPUs go online/offline.
    The container only sees that number of CPU.
  • Give me a specific set of CPUs (say, core 1, 3 and 5)
    Similar to the first mode except that no load-balancing is happening, you’re stuck with those cores no matter how busy they may be.
  • Give me 20% of whatever you have
    In this mode, you get to see all the CPUs but the scheduler will restrict you to 20% of the CPU time but only when under load! So if the system isn’t busy, your container can have as much fun as it wants. When containers next to it start using the CPU, then it gets capped.
  • Out of every measured 200ms, give me 50ms (and no more than that)
    This mode is similar to the previous one in that you get to see all the CPUs but this time, you can only use as much CPU time as you set in the limit, no matter how idle the system may be. On a system without over-commit this lets you slice your CPU very neatly and guarantees constant performance to those containers.
It’s also possible to combine one of the first two with one of the last two, that is, request a set of CPUs and then further restrict how much CPU time you get on those.

According to @dietmar Proxmox can do anything LXD does:

LXD uses LXC, so if LXD can do it, we can also do it. But so far I have not seen any patches.

So it looks possible to see and use only a limited number of load-balanced CPU cores inside a container. Is there any chance that we get to see these features (already available in LXC 2.0 with LXD) in Proxmox?
 
Last edited:
lxd have implemented some kind of cpu scheduler, but I'm not sure if it's working fine.
I think it's rebind lxc cores to physical cores only when a new container is starting.
But it don't manage current cpu load.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!