[lxc-users] memory limits

Fajar A. Nugraha list at fajar.net
Thu Apr 9 05:41:16 UTC 2015


On Thu, Apr 9, 2015 at 11:33 AM, Mohan G <mohan_gg at yahoo.com> wrote:
> Hi,
> query: if i create a cgroup with memory limit of 4GB  and if the system has
> 8GB ram, now if both the system wide pressure is pretty high, does it mean
> it can take away part of this cgroup memory and what if the cgroup now wants
> to run its workloads ?
> My question is whether there is any gurantee that memory limit set on the
> cgroups will be given/reserved to it.

No.

Your best bet would probably be to limit memory in other cgroups as
well, in a way that the sum of all top-level memory cgroup is below or
equal your total memory. For example, on my ubuntu 14.10, user-started
programs all reside under /user.slice/user-$(id -u).slice, while all
root-started containers lxc is under /lxc. All init-started daemons
(e.g. sshd) does not belong to any cgroup. In that scenario, you
could:
- limit memory use in /lxc to 4G
- limit memory use in /user.slice to use something like 3.5G
- manually move memory-hungry daemons to a new cgroup under
/user.slice (e.g. /user.slice/daemon/mysql). It will then inherit the
limit of its parent cgroup (/user.slice)

-- 
Fajar


More information about the lxc-users mailing list