- Mar 4, 2014
But this is not the number of CPUs presented to the CT. I set cpu limit = 2 on a container and htop display all the CPUs of the host, all of them working every now and then. cat /proc/cpuinfo show all CPUs, not the number assign by cpu limit. That can be misleading about the actual power available to the CT.So CPU limit is basically the maximum number of cores a container can utilize.
I disagree Dietmar. When containers are sold as vps, there should be a clear understanding of cpu resources for the customers. If they see 8 cores after buying a single core vps, they will have no incentive to upgrade, regardless of the fact that cpulimit will limit their actual share of processor resources.You can simply use KVM if you want full virtualization. IMHO CPU limit work greats, and there is no real reason to limit the number of visible CPUs for containers.
LXD uses LXC, so if LXD can do it, we can also do it. But so far I have not seen any patches.AFAIK when LXD will be stable, it'll, work this way, also with the possibility to limit IOPS (when it's finished). Are there any plans to integrate LXD and with it LXC 2.0 ?
This question makes no sense to me.Are there any plans to integrate LXD and with it LXC 2.0 ?
I would accept patches if someone finds a better way to do it.
Dietmar I'm not sure about LXD, but Ubuntu provides the desired functionality through lxcfs:LXD uses LXC, so if LXD can do it, we can also do it. But so far I have not seen any patches.
In that case, could you enable the bind-mounts of the replacement /proc files to show actual cpu number (cpu limit) and swap size available to a container?We also use the same lxcfs.
LXCFS is a simple userspace filesystem designed to work around some current limitations of the Linux kernel.
Specifically, it's providing two main things
- A cgroupfs-like tree which is container aware and works using CGManager.
- A set of files which can be bind-mounted over their /proc originals
to provide CGroup-aware values.
Thanks for this information. Problem is, assigning specific cores to containers would seriously impair fair scheduling on the host. As it's impossible to predict how much load one container would put on a specific core, it would be very hard to divide the available cores evenly between containers, most likely resulting in overloading some of the cores (while others would stay inactive).@gkovacs You can assign single cores to lxc containers with "lxc.cgroup.cpuset.cpus = 2,3" for cores 3 and 4 in /etc/pve/lxc/<ID>.conf and it will correctly display only 2 cpus in /proc/cpuinfo.
I recently stumbled across this issue as facter for puppet reported always all cores of the host system.
Are there any other options to limit the displayed amount of cpus in /proc/cpuinfo? Lxcfs seems only to use cpusets