We help IT Professionals succeed at work.

How to sumarize RAM (memory) used by process?

bxglxbxglx2000
bxglxbxglx2000 used Ask the Experts™
on
My server is Centos, running apache, php, mysql ....

When running, it increase memory much
Server has 8G RAM, and memory increase 1500MB, 1600MB .... to 8000MB

How can I check what process use much memory? What caused my problem?

Thank you!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Use the following command lines:
top
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | more
Call top (top)
then inside make Shift+F
now is list by %CPU
then press 'n' for order by memory

rgds
m203hcon
Hi,

This might not be problem! just check your Swap utilization and Load average by using top command.

In Linux first memory is almost fully utilized and then system uses swap also once the memory is fully utilized the count of memory used is never decreased until reboot (This does not means that memory is full and cant be re-utilized in that case pages stays in memory and memory get reclaimed by new process but the count will not be decreased) and when memory cant be reclaimed further then system
uses swap which mean you need to add more RAM.

Hence as a long there is no/less swap usage is system is running fine and no action is required. I hope this Helps.


ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r  is a good idea
But I think you likely would need to obtain the trend. So it would be a good idea to append the output into a file during a constant period of time using crontab and to check out the file in order to obtain the memory usage pattern.

type "cronteb -e" to add the following command into as a conjob which is suppose to run from every 10 minutes 9-5 daily.
0-59/10 9-17 * * * ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | head -10 >> /tmp/memusg.txt

Hi,

If you wish to get the trend of the resources (recorded periodically)  then  install "sysstat" rpm and use "sar" as follows

# rpm -ivh sysstat*rpm

Wait for some time (at least for 15 min) so that data will be generated then use

# sar -A

this will display the resource usage of your server.