[lxc-users] lxc memory limit doesn't work
Fajar A. Nugraha
list at fajar.net
Wed Apr 29 09:35:41 UTC 2015
https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxc-stable
On Wed, Apr 29, 2015 at 4:30 PM, Fırat KÜÇÜK <firatkucuk at gmail.com> wrote:
> I searched all the packages. I think there is nothing such lxcfs in ubuntu
> 14.04. LTS trusty.
>
>
>
> 2015-04-29 12:23 GMT+03:00 Fajar A. Nugraha <list at fajar.net>:
>>
>> Ah, OK.
>>
>> In that case, on the container, try:
>> mount | grep lxcfs
>> cat /proc/cpuinfo
>> cat /proc/meminfo
>>
>> IF you have lxcfs correctly installed and used by the containers (as
>> shown by mount command), cpuinfo and meminfo should contain
>> container-specific values as set on cgroups (e.g.
>> lxc.cgroup.cpuset.cpus, lxc.cgroup.memory.limit_in_bytes)
>>
>> if you DON'T see lxcfs there, check:
>> - whether lxcfs is running
>> - whether lxcfs hook is properly setup (e.g. on Ubuntu lxcfs has
>> /usr/share/lxc/config/common.conf.d/00-lxcfs.conf, and
>> /usr/share/lxc/config/common.conf includes
>> /usr/share/lxc/config/common.conf.d/)
>>
>> --
>> Fajar
>>
>> On Wed, Apr 29, 2015 at 4:09 PM, Fırat KÜÇÜK <firatkucuk at gmail.com> wrote:
>> > in fact.
>> >
>> > Today i setup lxd and lxc seperately.
>> >
>> > on lxd setup i used:
>> >
>> > lxc config set my-container limits.memory 4G
>> >
>> > and it worked.
>> >
>> > But i considered lxd is not quite stable for production. Than i used lxc
>> > then i created a container and edit conf-file
>> >
>> > lxc.cgroup.memory.limit_in_bytes = 2048M
>> >
>> > but it doesn't work.
>> >
>> > In both cases i used free -h or cat /proc/meminfo
>> >
>> >
>> >
>> > 2015-04-29 11:09 GMT+03:00 Fajar A. Nugraha <list at fajar.net>:
>> >>
>> >> 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
>> >> _______________________________________________
>> >> lxc-users mailing list
>> >> lxc-users at lists.linuxcontainers.org
>> >> http://lists.linuxcontainers.org/listinfo/lxc-users
>> >
>> >
>> >
>> >
>> > --
>> > FIRAT KÜÇÜK
>> >
>> > _______________________________________________
>> > lxc-users mailing list
>> > lxc-users at lists.linuxcontainers.org
>> > http://lists.linuxcontainers.org/listinfo/lxc-users
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>
>
>
>
> --
> FIRAT KÜÇÜK
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
More information about the lxc-users
mailing list