Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Incorrect RAM usage report in containers #175
Comments
varuzam
commented
Mar 24, 2017
|
i have the same problem in all my lxc conteainers
MemAvailable should be MemFree+Cached+Buffers |
|
I think this is due to kernel cgroup member memory.usage_in_bytes exporting the memory usage of the container as a whole, including cached. This member is used to collect memory usage data by lxcfs. Behavior for this was changed relatively lately in the kernel, so the behavior was correct before, however now it needs to be fixed. Cgroup member memory.stat should be used instead to parse these values. According to kernel documentation memory.stat is also more accurate than memory.usage_in_bytes, however I am not sure if this raises some performance concerns. Please see https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt for more information. I am looking into working for a patch on this one, but no guarantees. Could someone more knowledgeable confirm if I am right on this? |
snowfag
commented
Jun 8, 2017
|
I have this same issue. Cached ram on the host even caused an lxc container to start swapping due to thinking 100% of the ram was used. |
theredcat
commented
Jun 8, 2017
•
|
I've upgraded to 2.0.7 and those issues are resolved. Validation procedure to ensure that issue was indeed resolved :
|
YueHonghui
commented
Jul 5, 2017
|
I have same issue with lxcfs 2.0.7 (centos 7 3.10.0-514.16.1.el7, docker 1.11.1). cat /proc/meminfo
MemTotal: 6291456 kB
MemFree: 376 kB
MemAvailable: 376 kB
Buffers: 0 kB
Cached: 1768584 kB
SwapCached: 0 kB
Active: 4628400 kB
Inactive: 1662128 kB
Active(anon): 4521944 kB
Inactive(anon): 0 kB
Active(file): 106456 kB
Inactive(file): 1662128 kB
Unevictable: 0 kB
Mlocked: 463948 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 1664 kB
Writeback: 0 kB
AnonPages: 63824080 kB
Mapped: 579460 kB
Shmem: 14972 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 120416 kB
PageTables: 202012 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 98901132 kB
Committed_AS: 128121380 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 857852 kB
VmallocChunk: 34258080768 kB
HardwareCorrupted: 0 kB
AnonHugePages: 59121664 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 293624 kB
DirectMap2M: 10096640 kB
DirectMap1G: 192937984 kB |
|
Note that any results using Centos 7's 3.10 kernel cannot be trusted, since |
visit1985
commented
Jul 20, 2017
•
|
I have a similar issue on Ubuntu 16.04. lxd 2.14
MemAvailable is somehow reporting the same value as MemFree in lxcfs. It seems like Cached is not excluded from MemAvailable. Related to hishamhm/htop#599 |
towe75
commented
Sep 20, 2017
|
Hi, I am also affected by this problem on ubuntu 16.04 By looking at binding.c in 2.0 branch (and master) i can see that MemFree and MemAvailable indeed have the same calculation:
@theredcat are you sure the issue is resolved for you in lxcfs 2.0.7? The code snipped clearly states that there is no difference between MemFree and MemAvailable calculation. Should Available not sum up Cached and Buffered like @varuzam suggested above? Is this the correct approach? |
lilo-chita
commented
Sep 27, 2017
|
Same here. Ubuntu 16.04.3 LTS container# grep -E 'Mem|^Cached|Buff' /proc/meminfo container# free host# grep -E 'Mem|^Cached|Buff' /proc/meminfo host# free And it also starts swapping due to thinking 100% of the ram was used. |
theredcat commentedFeb 22, 2017
Hello,
I have a problem with lxcfs ram report in containers. It seems that the cached files from disk is shown as used memory.
Here is a example with a little one liner that :
free -mand grepused - buffers/cache(aka : the real used memory)Then a
free -mwith the same value but on the host.