Monitoring memory usage

Mark msalists at gmx.net
Mon Feb 21 21:10:38 UTC 2005


Hi guys,

I am trying to figure out how much memory a process is really using (in this case tomcat).
I tried ps and top, they give me different numbers.

Here is what top says:
  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
23691 root      25   0 37584  36M 11300 S     0.0  1.8   0:06   0 java


Here is what "ps vgax" says:
  PID TTY      STAT   TIME  MAJFL   TRS   DRS  RSS %MEM COMMAND
23691 ?        S      0:06   3383    55 456676 37580  1.8 /usr/java/jdk/bin/java ...bla...

Tomcat it self says the following (getting it from the Java-VM):
JVM
Free memory: 5.09 MB Total memory: 11.62 MB Max memory: 254.06 MB


So what is true now?
What do all the different ps and top numbers mean?

Some websites say ps does not display the proper numbers, but is there something better?
It does not have to be totally accurate, I am just trying to get an approximate feel for the memory consumption of tomcat over time
under different scenarios.
But the 36MB of top vs. the 12MB tomcat reports is a little too inaccurate. I didnt think that the java VM had that much overhead?!

What I am trying to do is collect the data using snmp and run some diagrams, so I need something that can be called from a script,
no graphical X application...

Thanks,

MARK




More information about the fedora-list mailing list