LXC container with unlimited cpulimit/memory

onlime

Renowned Member
Aug 9, 2013
76
14
73
Zurich, Switzerland
www.onlime.ch
How can I set CPU usage and memory to unlimited for a LXC container? This is used for a single CT which should be able to use all physical system resources. In some situations the Proxmox host node hosts 2 LXC containers, both without such limits. In more than 99% of the time it does only host a single CT, though.

In ProxmoxVE 4.2 WebUI I can only set a minimum of 512M for memory and setting `memory: 0` in /etc/pve/lxc/$VMID.conf also resets it to the minimum of 512M. Setting it to a high value (e.g. 99999999) will also affect swap size in the container.

What value should I choose for `cpulimit` if I don't know the total of CPU cores of the host system (the CT might be moved around from one host node to another with slightly different hardware)?
 
How can I set CPU usage and memory to unlimited for a LXC container? This is used for a single CT which should be able to use all physical system resources. In some situations the Proxmox host node hosts 2 LXC containers, both without such limits. In more than 99% of the time it does only host a single CT, though.

In ProxmoxVE 4.2 WebUI I can only set a minimum of 512M for memory and setting `memory: 0` in /etc/pve/lxc/$VMID.conf also resets it to the minimum of 512M. Setting it to a high value (e.g. 99999999) will also affect swap size in the container.

Lower limit of LXC is whatever works. I'm some boxes with only 64 MB and still plenty of free space. For very small machines, LXC is very, very efficient (in comparison to KVM, where the kernel needs a lot of RAM).

I did not know that the swap is set accordingly to main memory, so yes, you're right on that. Yet, is this really a problem? I can set and run a LXC container with 128 GB RAM on a machine with only 16 GB RAM, yes, the swap will then be roughly the same size of 112 GB, but it works and the machine cannot allocate 112 GB either and hopefully never will.

What value should I choose for `cpulimit` if I don't know the total of CPU cores of the host system (the CT might be moved around from one host node to another with slightly different hardware)?

Technically, the maximum value is nowadays on "off-the-shelf" server hardware 96 threads on two 24-core XEON with HT, so that is a good upper limit, if applicable (haven't tried that)
 
So, seriously, there is no "unlimited" flag or anything similar in LXC? Simply selecting a huge value seems a bit messy in my eyes, more of a dirty workaround than a real solution.

(a bit off-topic) Also, I am confused about all CPU cores being displayed inside the container, no matter which value for `cpulimit` I choose. Hope this makes it sooner or later into LXCFS/Proxmox:
Well, well, I just gotta get used to LXC and bury good ol' OpenVZ.
 
Sorry for bumping an old thread, but this came up in a Google search, and I'm sure it will for others, so I wanted to respond and raise a query.

There wasn't a clear answer here, but a great deal of technical explanations. A lot of technical information in a condensed format is great.

However, I am very interested in a solid answer on how to tell a container that it should use whatever the host's CPU can handle without having to "lie" to a container. The poster above has a VERY valid point that had no response: "Simply selecting a huge value seems a bit messy in my eyes, more of a dirty workaround than a real solution"

I'm running Plex in my container and am very concerned about transcoding since it will require direct, intense CPU access.

I will ask this directly: Is there any way to tell a container to use all available CPU threads on its host without having to specify a number? If not, that's fine, but I'd appreciate a direct answer.

Thanks!

-J
 
Bump, This unlimited for Plex transcoding is the use case I am interested in as well. This is the default behavior of docker but it seems Proxmox's LXC implementation has a different strategy
 

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!