Jump to content

Linux command to show memory usage of particular process?


Recommended Posts

Does anyone know Linux command, by which I can know total memory usage of a particular process?

Example:
14275 xxxxx 20 0 565m 62m 32m S 0 0.8 0:01.10 apache2
14316 xxxxx 20 0 561m 47m 19m S 0 0.6 0:00.28 apache2
14334 xxxxx 20 0 549m 37m 21m S 0 0.5 0:00.16 apache2
14338 xxxxx 20 0 563m 44m 14m S 0 0.6 0:00.54 apache2
14339 xxxxx 20 0 542m 13m 3496 S 0 0.2 0:00.00 apache2
14343 xxxxx 20 0 559m 40m 14m S 0 0.5 0:00.28 apache2
14345 xxxxx 20 0 549m 26m 9m S 0 0.3 0:00.00 apache2
14346 xxxxx 20 0 549m 28m 12m S 0 0.4 0:00.06 apache2
14347 xxxxx 20 0 554m 32m 11m S 0 0.4 0:00.06 apache2
14348 xxxxx 20 0 561m 41m 13m S 0 0.5 0:00.56 apache2
14349 xxxxx 20 0 562m 44m 14m S 0 0.6 0:00.48 apache2
14356 xxxxx 20 0 548m 24m 9228 S 0 0.3 0:00.04 apache2

I would like to know total memory usage of all apache2 process together rather then as % of total memory.

Link to comment
Share on other sites

In SSH type in:

top



Then press:

shift + M



This will show it based on memory usuage, Now depending on the spawns, I would not let apache use more than 5mb per process and 0% CPU, If you exceed that then you may encounter issues and optimization is needed.


Hope it helps.
Link to comment
Share on other sites


This will show it based on memory usuage, Now depending on the spawns, I would not let apache use more than 5mb per process and 0% CPU, If you exceed that then you may encounter issues and optimization is needed.


Hope it helps.




0% CPU? If process has spawned will it not use CPU? Also, I think mine uses more then 5Mb. Do you know what issue can be?
Link to comment
Share on other sites


Possibly lots of connections.



whats your current connections to apache




How to find current connections to apache?

I tried this 'netstat -an | grep :80 | sort' and it gives me 32. Any other way to find connections?

Also, ps aux | grep apache| wc -l gives me value of 20.
Link to comment
Share on other sites

netstat -an | grep 80 | wc -l



Thats fine, 32 is not alot... Infact it's probably idle.

whats the output of:

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n



Any unusual amount of connections in there, And anything that you do not reconise when running:

tail -f /var/log/messages

Link to comment
Share on other sites

Gary, what does this means?

Jan 10 06:25:02 server rsyslogd: [origin software="rsyslogd" swVersion="3.18.6" x-pid="3116" x-info="http://www.rsyslog.com"] restart
Jan 11 06:25:01 server kernel: imklog 3.18.6, log source = /proc/kmsg started.
Jan 11 06:25:01 server rsyslogd: [origin software="rsyslogd" swVersion="3.18.6" x-pid="3116" x-info="http://www.rsyslog.com"] restart
Jan 12 02:53:10 server kernel: [1139013.562766] NETDEV WATCHDOG: eth0: transmit timed out
Jan 12 02:53:11 server kernel: [1139013.579201] r8169: eth0: link up
Jan 12 06:25:02 server kernel: Kernel logging (proc) stopped.
Jan 12 06:25:02 server kernel: imklog 3.18.6, log source = /proc/kmsg started.
Jan 12 06:25:02 server rsyslogd: [origin software="rsyslogd" swVersion="3.18.6" x-pid="3116" x-info="http://www.rsyslog.com"] restart
Jan 12 07:02:34 server kernel: [1157380.949499] NETDEV WATCHDOG: eth0: transmit timed out
Jan 12 07:02:35 server kernel: [1157380.965811] r8169: eth0: link up

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...