[lxc-users] limits.memory - possible to set per group of containers?

Fajar A. Nugraha list at fajar.net
Tue Jun 18 02:34:48 UTC 2019


On Tue, Jun 18, 2019 at 7:47 AM Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> Let's say I have a host with 32 GB RAM.
>
> To make sure the host is not affected by any weird memory consumption
> patterns, I've set the following in the container:
>
>    limits.memory: 29GB
>
> This works quite well - where previously, several processes with high
> memory usage, forking rapidly (a forkbomb to test, but also i.e. a
> supervisor in normal usage) running in the container could make the host
> very slow or even unreachable - with the above setting, everything (on
> the host) is just smooth no matter what the container does.
>
> However, that's just with one container.
>
> With two (or more) containers having "limits.memory: 29GB" set - it's
> easy for each of them to consume i.e. 20 GB, leading to host
> unavailability.
>
> Is it possible to set a global, or per-container group "limits.memory:
> 29GB"?
>
> For example, if I add "MemoryMax=29G" to
> /etc/systemd/system/snap.lxd.daemon.service - would I achieve a desired
> effect?
>
>
>

You could probably just use nested lxd instead:
https://stgraber.org/2016/12/07/running-snaps-in-lxd-containers/

Set the outer container memory limit to 29GB, and put other containers
inside that one.

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20190618/71eb9d70/attachment.html>


More information about the lxc-users mailing list