New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Memory usage not clear
collaborando
Member
below the result of "top" :
Mem: 262144k total, 45456k used, 216688k free, 0k buffers Swap: 0k total, 0k used, 0k free, 0k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 15 0 2824 1376 1220 S 0.0 0.5 0:00.50 init 1142 root 14 -4 2304 624 436 S 0.0 0.2 0:00.00 udevd 1365 root 25 0 35548 1240 944 S 0.0 0.5 0:00.00 rsyslogd 1383 root 18 0 8240 1092 684 S 0.0 0.4 0:00.00 sshd 1390 root 25 0 3116 888 716 S 0.0 0.3 0:00.00 xinetd 1397 root 18 0 6744 780 472 S 0.0 0.3 0:00.00 saslauthd 1398 root 18 0 6744 488 180 S 0.0 0.2 0:00.00 saslauthd 1405 root 18 0 6984 1164 624 S 0.0 0.4 0:00.00 crond 1419 root 15 0 11112 3256 2664 S 0.0 1.2 0:00.06 sshd 1422 root 15 0 6224 1648 1404 S 0.0 0.6 0:00.01 bash 1447 root 15 0 2520 1040 868 R 0.0 0.4 0:00.00 top
45M of RAM used but sum of %MEM of all process is 4%.
4% of 256M Memory total is not 45M.
Where my memory is used?
OS: CentOS 6
VPS: 128M / 256M
thanks a lot.
Comments
Hi
Use free -m
In my example I am using 138 MB.
If you want to know the memory used but every process, then is another story. Mmm, in a KVM/Xen/physical platform, generally I take the RES column, but I am not sure.
In openVZ this isn't valid, the processes use more RAM than RES shows.
use command "ps v" to see which app takes what exaclty
to save some memory: apt-get --purge remove syslog-ng rsyslog udev cron
also change ssh to dropbear
ps_mem
I think most of that occurs with the lowendscript:
http://www.lowendbox.com/blog/wordpress-cheap-vps-lowendscript/
This is my free -m ( @yomero )
Results of ps_mem (see @circus comment)
Top command is above in my first post.
4.7M are used by programm where are the rest of used memory?
@drmike: at this time I don't want optimize my memory usage I want know where my memory is used.
Thanks.
@drmike, no I meant lowendscript is purging the bits that @kristal suggests up there.
is this a 64bit system?
is this xen or open?
@collaborando
Well, because that you are in an OpenVZ VPS, the ps_mem isn't accurate, as I said, openVZ manages the memory in a different way. How? I am not sure, but look at the VIRT columns in top (htop is better ), in some processes is a better way to measure the RAM consumption in OpenVZ.
Don't use rsyslog, it wastes too much ram on a OpenVZ VPS.
Really? I don't use it too, but I don't see any significant gain. How much is "too much ram"? Less than 1-2MB IMO
on an open vz, usually 96 or 128, everything is too much :P must be strict with ram control :->
just to use resouces in the most efficient way that is :P
install debian 5 :->
31mb for a syslog daemon is too much.
The best way I have found for knowing how much ram something uses on a openvz vps is to run free -m, stop it, then run free -m again due to openvz's allocation (not usage) based memory limits
On my KVM VPS, ps_mem reports more ram used than free -m:
WTF, my rsyslog doesn't use so much. Or it has memory leaks? Because at the start it uses like 2-3MB ram
On a OpenVZ VPS?
@dmmcintyre3 thank you for suggest
afeter service rsyslog stop
rsyslog takes 25M on my OpenVZ VPs with CentOS6.
I found this about optimizing difference between VIRT and RES memory on OpenVZ:
http://www.lowendbox.com/blog/reduce-stack-limit-for-multi-thread-apps/
@yomero thank you.
Yeah, that post is useful too
Are there any noticeable downsides in reducing stack limit?
Some software can crash, but, that happens with extreme settings like...
ulimit -s 32
or sth ike that