amuck-landowner

Ubuntu 14.04 OpenVz Memory Reporting Oddness

sleddog

New Member
[root@u14:~] uname -a
Linux u14 2.6.32-042stab102.9 #1 SMP Fri Dec 19 20:34:40 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@u14:~] free -m
             total       used       free     shared    buffers     cached
Mem:           512         90        421         76          0         90
-/+ buffers/cache:          0        512
Swap:          256          0        256
The container runs nginx, mysql, php-fpm with no issues. Hostnode is CentOS 6. Both the hostnode and the container have been restarted since recent updates.

Other containers (Ubuntu 12.04, Debian 7) show normal memory reporting.

Not sure when this started, didn't notice until now... :)
 
Last edited by a moderator:

HalfEatenPie

The Irrational One
Retired Staff
Have you tried turning it off and on again?

haha totally kidding.  Definitely seems a bit fishy.  
 

sleddog

New Member
I still see this issue in containers with recent OpenVz kernels.

Kernel 2.6.32-042stab102.9 shows 0 memory usage, at least with Ubuntu 12.04 32bit and Ubuntu 14.04 64bit. Note that the U 14.04 container did show memory usage upon initial install, but showed 0 usage after an apt-get update && apt-get upgrade.

Later kernels do show memory usage, but under-report it.

For example:


[root@red:~] uname -a
Linux red 2.6.32-042stab104.1 #1 SMP Thu Jan 29 12:58:41 MSK 2015 i686 i686 i386 GNU/Linux
[root@red:~] free -m
total used free shared buffers cached
Mem: 512 106 405 0 0 95
-/+ buffers/cache: 10 501
Swap: 512 4 507


With nginx, php-fpm, mysql, exim4 and an active Wordpress site, there's no way that container is running in 10 MB RAM :)

I went back to the user_beancounters and wrote a bash script (ofree) to calculate memory usage based on the values there.


[root@red:~] ofree
total used free shared cached
Mem: 512 104 408 43 56
-cache: 48 464
Swap: 512 5 507


48 MB usage -- much more realistic.

ofree is here: https://github.com/sleddoggy/ofree

----

On an older OpenVZ kernel, not affected by this recent memory-reporting oddness, the output of free and ofree inside a container correlate nicely:


[root@par:~] uname -a
Linux par 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 i686 i686 i386 GNU/Linux
[root@par:~] free -m
total used free shared buffers cached
Mem: 512 89 422 0 0 31
-/+ buffers/cache: 58 453
Swap: 512 0 512
[root@par:~] ofree
total used free shared cached
Mem: 512 89 423 40 31
-cache: 58 454
Swap: 512 0 512


Just +/- 1 MB here and there, attributable to Bash rounding.
 
Last edited by a moderator:

rds100

New Member
Verified Provider
Check the raw values in /proc/meminfo - maybe there is some white space / alignment change that the userspace tools in ubuntu 14.04 can't parse properly.
 

sleddog

New Member
Check the raw values in /proc/meminfo - maybe there is some white space / alignment change that the userspace tools in ubuntu 14.04 can't parse properly.
I did, and I don't see a difference.

To be clear, this issue isn't restricted to Ubuntu 14 -- my initial post is wrong in that regard.

It also affects Debian 7 and Ubuntu 12.04.
 
Top
amuck-landowner