Discussion:
[lxc-users] lxc memory limit doesn't work
Fırat KÜÇÜK
2015-04-29 07:17:01 UTC
Permalink
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?
--
FIRAT KÜÇÜK
Mark Constable
2015-04-29 07:19:54 UTC
Permalink
Post by Fırat KÜÇÜK
lxc.cgroup.memory.limit_in_bytes = 2048M
but my container free -h output shows 32GB
Is there anything that i missed?
For me on ubuntu I had to add this to my default grub line and reboot...

~ grep cgroup /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash cgroup_enable=memory swapaccount=1"
Fırat KÜÇÜK
2015-04-29 07:30:15 UTC
Permalink
Unfortunately it doesn't work.
Post by Mark Constable
Post by Fırat KÜÇÜK
lxc.cgroup.memory.limit_in_bytes = 2048M
but my container free -h output shows 32GB
Is there anything that i missed?
For me on ubuntu I had to add this to my default grub line and reboot...
~ grep cgroup /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash cgroup_enable=memory
swapaccount=1"
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Fajar A. Nugraha
2015-04-29 08:09:20 UTC
Permalink
Post by Fırat KÜÇÜK
Hi,
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
Fırat KÜÇÜK
2015-04-29 09:09:10 UTC
Permalink
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Fırat KÜÇÜK
2015-04-29 09:22:52 UTC
Permalink
I noticed that i have no /sys/fs/cgroup/lxc/ directory. Is it a problem?

Instead: cgmanager and systemd directories exist.
Post by Fırat KÜÇÜK
in fact.
Today i setup lxd and lxc seperately.
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
--
FIRAT KÜÇÜK
Fajar A. Nugraha
2015-04-29 09:23:07 UTC
Permalink
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
Post by Fırat KÜÇÜK
in fact.
Today i setup lxd and lxc seperately.
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
Fırat KÜÇÜK
2015-04-29 09:30:55 UTC
Permalink
I searched all the packages. I think there is nothing such lxcfs in ubuntu
14.04. LTS trusty.
Post by Fajar A. Nugraha
Ah, OK.
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)
- 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
Post by Fırat KÜÇÜK
in fact.
Today i setup lxd and lxc seperately.
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Fajar A. Nugraha
2015-04-29 09:35:41 UTC
Permalink
https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxc-stable
Post by Fırat KÜÇÜK
I searched all the packages. I think there is nothing such lxcfs in ubuntu
14.04. LTS trusty.
Post by Fajar A. Nugraha
Ah, OK.
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)
- 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
Post by Fırat KÜÇÜK
in fact.
Today i setup lxd and lxc seperately.
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
Fırat KÜÇÜK
2015-04-29 10:13:30 UTC
Permalink
I reinstalled the lxc, lxcfs service cannot start.

limit is the same.

Fajar and Guido. Thanks for your support.

BTW I will reinstall the LXD. It is quite user friendly and stable for me.
Post by Fajar A. Nugraha
https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxc-stable
Post by Fırat KÜÇÜK
I searched all the packages. I think there is nothing such lxcfs in
ubuntu
Post by Fırat KÜÇÜK
14.04. LTS trusty.
Post by Fajar A. Nugraha
Ah, OK.
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)
- 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
Post by Fırat KÜÇÜK
in fact.
Today i setup lxd and lxc seperately.
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
Post by Fırat KÜÇÜK
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
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
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Hi,
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.
Post by Fırat KÜÇÜK
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
Post by Fajar A. Nugraha
lxcfs should help in some situations, but not all.
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
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Fajar A. Nugraha
2015-04-29 10:25:53 UTC
Permalink
Post by Fırat KÜÇÜK
I reinstalled the lxc, lxcfs service cannot start.
... because ?

There should be a log on /var/log/upstart/lxcfs.log.

Or you could try starting it manually:
/usr/bin/lxcfs -s -f -o allow_other /var/lib/lxcfs
--
Fajar
Fırat KÜÇÜK
2015-04-29 10:29:21 UTC
Permalink
call to move_pid_abs (all:/) failed: invalid request
WARNING: failed to escape to root cgroup
call to list_controllers failed: Method "ListControllers" with signature ""
on interface "org.linuxcontainers.cgmanager0_0" doesn't exist
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
I reinstalled the lxc, lxcfs service cannot start.
... because ?
There should be a log on /var/log/upstart/lxcfs.log.
/usr/bin/lxcfs -s -f -o allow_other /var/lib/lxcfs
--
Fajar
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Fajar A. Nugraha
2015-04-29 10:31:16 UTC
Permalink
How did you install lxcfs?

Looks like your version of cgmanger is not new enough. The ppa should
also have updated cgmanager

... or if you have updated, you might simply need to reboot first.
Post by Fırat KÜÇÜK
call to move_pid_abs (all:/) failed: invalid request
WARNING: failed to escape to root cgroup
call to list_controllers failed: Method "ListControllers" with signature ""
on interface "org.linuxcontainers.cgmanager0_0" doesn't exist
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
I reinstalled the lxc, lxcfs service cannot start.
... because ?
There should be a log on /var/log/upstart/lxcfs.log.
/usr/bin/lxcfs -s -f -o allow_other /var/lib/lxcfs
--
Fajar
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
Fırat KÜÇÜK
2015-04-29 11:33:17 UTC
Permalink
I purged every single dependent package then i installed lxd from
*ppa:ubuntu-lxc/lxd-stable*

Now lxcfs works.

and the result:

***@my-container:/# free -h
total used free shared buffers cached
Mem: 2.0G 10M 2.0G 492K 0B 228K
-/+ buffers/cache: 10M 2.0G
Swap: 7.6G 0B 7.6G

problem solved.

So learned lessons: Packages should be the most recent stable versions.

Thanks.
Post by Fajar A. Nugraha
How did you install lxcfs?
Looks like your version of cgmanger is not new enough. The ppa should
also have updated cgmanager
... or if you have updated, you might simply need to reboot first.
Post by Fırat KÜÇÜK
call to move_pid_abs (all:/) failed: invalid request
WARNING: failed to escape to root cgroup
call to list_controllers failed: Method "ListControllers" with signature
""
Post by Fırat KÜÇÜK
on interface "org.linuxcontainers.cgmanager0_0" doesn't exist
Post by Fajar A. Nugraha
Post by Fırat KÜÇÜK
I reinstalled the lxc, lxcfs service cannot start.
... because ?
There should be a log on /var/log/upstart/lxcfs.log.
/usr/bin/lxcfs -s -f -o allow_other /var/lib/lxcfs
--
Fajar
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
_______________________________________________
lxc-users mailing list
http://lists.linuxcontainers.org/listinfo/lxc-users
--
FIRAT KÜÇÜK
Loading...