[lxc-users] lxc memory limit doesn't work

Fajar A. Nugraha list at fajar.net
Wed Apr 29 08:09:20 UTC 2015


On Wed, Apr 29, 2015 at 2:17 PM, Fırat KÜÇÜK <firatkucuk at gmail.com> wrote:
> Hi,
>
> i updated the config file:
> lxc.cgroup.memory.limit_in_bytes = 2048M
>
> but my container free -h output shows 32GB
>
> Is there anything that i missed?

Not really.

In most (all?) lxc setup, various tools (e.g. free, top) on the
container will show the host's total resources. You will only see the
limit take effect once you run some memory and cpu-intensive programs.
lxcfs should help in some situations, but not all.

>From the host, run:

lxc-cgroup -n CONTAINER_NAME memory.limit_in_bytes
lxc-cgroup -n CONTAINER_NAME memory.usage_in_bytes

The second output should always be lower than the first. Once the
container's usage approach the set limit, you'd see OOM-messages on
syslog and programs on the container will be automatically killed
courtesy of OOM killer.

-- 
Fajar


More information about the lxc-users mailing list