[lxc-users] Is it possible to change lxc.cgroup.memory.limit_in_bytes in runtime? [LXD]

Fajar A. Nugraha list at fajar.net
Mon Jul 3 09:06:58 UTC 2017


On Mon, Jul 3, 2017 at 7:05 AM, Ivan Kurnosov <zerkms at zerkms.ru> wrote:

> Hi,
>
> I've went through the lxd and go-lxc binding to find the answer myself but
> I stuck at
>
> bool go_lxc_set_config_item(struct lxc_container *c, const char *key,
> const char *value) {
> return c->set_config_item(c, key, value);
> }
>
> Internally - that's how the config parameters are changed.
>
> But is it possible to change lxc config parameters
> like lxc.cgroup.memory.memsw.limit_in_bytes or lxc.cgroup.memory.limit_in_bytes
> in runtime using some of lxc or lxd cli utils, so that it was not required
> to restart a container to get its new memory limits.
>
>
In lxc, the only way I know how is to modify cgroup files directly. e.g.
/sys/fs/cgroup/memory/lxc/your_container_name/memory.limit_in_bytes . That
would modify current effective value, while editing lxc config file would
ensure the new config stays the same after container stop-start.

In lxd, for some limits (e.g. limits.memory, the equivalent
of lxc.cgroup.memory.memsw.limit_in_bytes), "lxc config edit
your_container_name" should modify both effective and configured limits
interactively. You can also perform the change non-interactively, see "lxc
config help" for details. I don't think memory.memsw.limit_in_bytes has an
lxd equivalent though.

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


More information about the lxc-users mailing list