LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   monitor memory usage for process (https://www.linuxquestions.org/questions/linux-server-73/monitor-memory-usage-for-process-858256/)

chuikingman 01-24-2011 01:22 AM

monitor memory usage for process
 
Hi,
I use linux and Unix and I want to monitor the memory usage for process.
To prevent memory leakage and out of memory of the system.
Any command or sytnax , have more better and presentable data
than below command about memory usage of one process ??

ps -o %cpu,%mem,lstart,args,comm,cputime,pid,rss,vsz -p 10537

%CPU %MEM STARTED COMMAND COMMAND TIME PID RSS VSZ
0.8 10.6 Mon Jan 24 13:37:07 2011 /opt/j2sdk1.4.2_ java_executable 00:00:33 10537 111708 910044

any suggestion ??

unSpawn 01-24-2011 07:47 PM

While this may sound obvious it might get you there in time to restart a process but monitoring memory usage does not prevent memory leaks: better coding may. Expecting the system to compensate for a user deciding to deploy a crappy coded .war file is like fighting symptoms instead of fighting the cause. Back to your question you could reinvent the wheel if that's what you're after or use existing tools like jconsole / jhat to check Java processes and say Monit for watching process memory and automagic restarting it?

an15wn 01-24-2011 08:05 PM

Hi chui,

I don't know what's your distro, mines are Fedora and Ubuntu.
I usually use htop for realtime process monitoring. Htop is text based, curse based application.

chuikingman 01-24-2011 08:14 PM

Quote:

Originally Posted by unSpawn (Post 4236630)
While this may sound obvious it might get you there in time to restart a process but monitoring memory usage does not prevent memory leaks: better coding may. Expecting the system to compensate for a user deciding to deploy a crappy coded .war file is like fighting symptoms instead of fighting the cause. Back to your question you could reinvent the wheel if that's what you're after or use existing tools like jconsole / jhat to check Java processes and say Monit for watching process memory and automagic restarting it?

Can I only use general unix/linux command to observe and monitor the system.
Which command you suggest ??

---------- Post added 01-25-11 at 10:14 AM ----------

Quote:

Originally Posted by an15wn (Post 4236639)
Hi chui,

I don't know what's your distro, mines are Fedora and Ubuntu.
I usually use htop for realtime process monitoring. Htop is text based, curse based application.

Can I only use general unix/linux command to observe and monitor the system.
Which command you suggest ??


All times are GMT -5. The time now is 09:12 PM.