[Lxc-users] balance cpus

Jäkel, Guido G.Jaekel at dnb.de
Mon May 23 07:39:01 UTC 2011


Hi all,

i'm going to use LXC as a lightweight instrument to partition a modern equipped blade server center into discrete, handy units to run a set of business applications in it. Because it's a "friendly environment", I don't have to focus on jail security. But I want to use the features of the cgroup systems to assign a dedicated amount of different resources to the containers to minimize the impact of a "misbehaving" application to the others.

Therefore, I want to assign the number of cpu cores as well as the amount of usable memory. But in opposite to the cgroup memory subsystem, where I operate with the amount of memory by the abstract number of bytes, within the cgroup cpuset subsystem I have to deal with a concrete list of cores. 

That is a concern I don't want to deal with while configuring a container setup, because as like as for the memory I want to define here just the amount of cpu power, i.e. the number of cores. But the current API for "cpuset.cpus" don't offer any support for this, e.g. a syntax to claim the "next n free cores".

As a proof of concept to deal with this, I've start to develop an external script to run on a lxc host. By each run it will balance out the reserved cores of all containers: The number of assigned cores is kept, but they are spread round-robin of the available cores of the host. Using this script, I just have to configure the number of cores for my LXC container configuration files (lxc.cgroup.cpuset.cpus = 0-<n-1>). And after startup (or shutdown) of a (set of) container(s) on a specific blade host, I let it re-assign the concrete used cores. 


I'll attached my alpha version of a script. The next todo is (instead of just incrementing the core number) to introduce an "precedence table" for the cores to respect the technical concerns like real cores vs. hypertheating or the impacts of a NUMA architecture. This might be constructed by sorting the information of /proc/cpuinfo in a appropriate way. Another one is to support the "exclusive cpu" setting.

But any other comments on this are welcome. To the LXC maintainers: Might this be bundled with the LXC distribution in spite of it's not realy restricted to LXC? Should it be rewritten in perl because most of the other work is done using this language?


with greetings

Guido

-------------- next part --------------
A non-text attachment was scrubbed...
Name: balance-cpus
Type: application/octet-stream
Size: 2781 bytes
Desc: balance-cpus
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110523/b421c706/attachment.obj>


More information about the lxc-users mailing list