[Lxc-users] total RAM limit

Stéphane Graber stgraber at ubuntu.com
Fri Jan 11 19:49:51 UTC 2013


On 01/11/2013 01:17 PM, Gary Ballantyne wrote:
> Hello All
> 
> I understand that I can limit the RAM of a single container via 
> lxc.cgroup.memory.limit_in_bytes. But, is there a way to limit the total
> RAM available to all containers (without limiting each individually)?
> 
> E.g., say we have 4G available. Rather than specifying a maximum number
> of containers (16 with 250M say), I'd like to allocate 4G to all
> containers, without a hard upper limit on the number of containers (16
> in this case), and let the performance degrade gradually as more
> containers are added. (I'm anticipating being able to use many more
> containers this way, since our container's RAM usage is likely to be
> bursty).

You can, but not through lxc configuration.

LXC uses the "lxc" directory in the cgroup hierarchy, so that your
container is typically at:
lxc/<container name>/

Manually changing the keys in the lxc directory will set a shared quota
for everything under it.

As a concrete example, on my laptop, the memory cgroup is mounted at:
/sys/fs/cgroup/memory/

And individual container cgroups are at:
/sys/fs/cgroup/memory/lxc/<container name>

So setting /sys/fs/cgroup/memory/lxc/memory.limit_in_bytes would do what
you want.

> Many thanks
> 
> Gary
> 
> 
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> 
> 
> 
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130111/af965ef8/attachment.pgp>


More information about the lxc-users mailing list