I have a VPS with VPSnoc and it is exhibiting some strange behaviour. When I total the %MEM column from a "ps faux" I get around 23%, but when I run free I get 419580/524288 = 80% used. That's a lot of RAM to be being used by non-processes, way more than on any other box I administer, or even my friend's VPS with the same provider.
I've emailed the VPSnoc support a couple of times now, but they don't even seem to be able to understand that this is a very weird thing to have happening on a system.
I wouldn't complain, except that I occasionally get out of memory errors (like when I try to set apache2 workers to >7 threads or >8 simultaneous connections) and those are just not nice.
Is there any way this could be a configuration problem that I could fix/work around, or any way this could be normal? I'm losing hope that VPSnoc will even acknowledge the problem.
They use OpenVZ, if that helps.
Edit: I have tweaked some MySQL settings, and that made what ps reported for it's RAM usage go from 7% to 4%, but the amount of RAM use reported by free dropped about 20%. I'm not longer getting out-of-memory errors, but would still like to understand the reporting better. The current output of free -m is:
total used free shared buffers cached
Mem: 512 320 191 0 0 0
-/+ buffers/cache: 320 191
Swap: 0 0 0
I understand better now the buffers/cache differences that can exist, but none are being shown by this output (or ever were being shown on this box) and that shouldn't cause actual out-of-memory errors.
See http://www.linuxatemyram.com/ for an explanation of what free displays.
Do you have swap enabled?
(Edit) and please post the complete output of free.
I use this script to get more information about memory usage: http://www.pixelbeat.org/scripts/ps_mem.py
After tons of debugging and fighting with my host, I am almost certain that this is just a bug either with OpenVZ or with the way they use it. It seems that the %MEM in ps is showing % of actual physical RAM, whereas free is showing my the amount of my allocated VPS RAM I have free.
When you run
free
, the output of the "used" column includes buffers and caches, which is normal for a Linux box to utilize. Linux has one of the most advanced memory managers out there, so it tries to take advantage of "free" memory to help the slower parts of your system, like your disks. Check this output:From here, it looks like the system is consuming 88% of memory, but about 52% of it is OS cache and another 11% are buffers. It takes some getting used to, but Linux tries it's best to make use of "free" memory.