# Ubuntu 14.04 OpenVz Memory Reporting Oddness



## sleddog (Dec 29, 2014)

[[email protected]:~] 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
[[email protected]:~] 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...


----------



## HalfEatenPie (Dec 29, 2014)

Have you tried turning it off and on again?

haha totally kidding.  Definitely seems a bit fishy.


----------



## sleddog (Dec 29, 2014)

HalfEatenPie said:


> Have you tried turning it off and on again?
> 
> haha totally kidding.  Definitely seems a bit fishy.


Yes, node & container restarted 

I think I've somehow achieved the ultimate objective: 0 memory usage.


----------



## DomainBop (Dec 29, 2014)

The last time I (and several others) experienced 0 memory usage was the Incero Vapor beta. ..no idea what the exact cause was though, sorry..


----------



## gordonrp (Dec 30, 2014)

DomainBop said:


> The last time I (and several others) experienced 0 memory usage was the Incero Vapor beta. ..no idea what the exact cause was though, sorry..


Vapor is now www.wable.com 

This is what I see on wable for ubuntu 14.04, also using a centos 6 host node;


----------



## sleddog (Mar 20, 2015)

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:


[[email protected]:~] uname -a
Linux red 2.6.32-042stab104.1 #1 SMP Thu Jan 29 12:58:41 MSK 2015 i686 i686 i386 GNU/Linux
[[email protected]:~] 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.


[[email protected]:~] 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:


[[email protected]:~] uname -a
Linux par 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 i686 i686 i386 GNU/Linux
[[email protected]:~] free -m
total used free shared buffers cached
Mem: 512 89 422 0 0 31
-/+ buffers/cache: 58 453
Swap: 512 0 512
[[email protected]:~] 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.


----------



## rds100 (Mar 20, 2015)

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 (Mar 20, 2015)

rds100 said:


> 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.


----------

