<div dir="ltr"><div dir="ltr">On Tue, Jun 18, 2019 at 7:47 AM Tomasz Chmielewski <<a href="mailto:mangoo@wpkg.org">mangoo@wpkg.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Let's say I have a host with 32 GB RAM.<br>
<br>
To make sure the host is not affected by any weird memory consumption <br>
patterns, I've set the following in the container:<br>
<br>
   limits.memory: 29GB<br>
<br>
This works quite well - where previously, several processes with high <br>
memory usage, forking rapidly (a forkbomb to test, but also i.e. a <br>
supervisor in normal usage) running in the container could make the host <br>
very slow or even unreachable - with the above setting, everything (on <br>
the host) is just smooth no matter what the container does.<br>
<br>
However, that's just with one container.<br>
<br>
With two (or more) containers having "limits.memory: 29GB" set - it's <br>
easy for each of them to consume i.e. 20 GB, leading to host <br>
unavailability.<br>
<br>
Is it possible to set a global, or per-container group "limits.memory: <br>
29GB"?<br>
<br>
For example, if I add "MemoryMax=29G" to <br>
/etc/systemd/system/snap.lxd.daemon.service - would I achieve a desired <br>
effect?<br>
<br>
<br></blockquote><div><br></div><div><br></div><div>You could probably just use nested lxd instead: <a href="https://stgraber.org/2016/12/07/running-snaps-in-lxd-containers/" target="_blank">https://stgraber.org/2016/12/07/running-snaps-in-lxd-containers/</a></div><div><br></div><div>Set the outer container memory limit to 29GB, and put other containers inside that one.</div><div><br></div><div>-- </div><div>Fajar </div></div></div>