question about memory usage in linux

Michael Torrie torriem at chem.byu.edu
Tue Nov 22 11:37:11 MST 2005


On Tue, 2005-11-22 at 10:13 -0700, Gregory Hill wrote:
> Excuse my ignorance again, but where do you get the 10MB swap figure for
> Apache and 20MB figure for mysql?  Is that in top, but I just don't see
> it?  Anyway, I'll keep watching it to see if I can find a pattern.  The
> problem is it usually crashes at night, when I'm asleep.  My guess is
> still a mod_perl leak, but for some reason it only occurs during the
> night.  Does anyone know a good memory monitoring script that can email
> me details at a certain threshold?  I'll write my own if not, but if
> there's something already out there, I'd love to save the hassle.

I got the approximate figures from your ps output.  I've deleted that
message now, but I basically took the vsz column (total virtual memory
size) and subtracted the resident size column from it.

Top does indeed show this kind of thing.  Not sure if top has changed
since RH9, but FC1, top shows the following headings by default:

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU
COMMAND
11365 root      16   0 29268  23M  8768 S     0.0  1.1   1:27   0 spamd
12098 root      18   0 28744  22M  8532 S     0.0  1.1   1:52   0 spamd
12087 root      16   0 28768  22M  8436 S     0.0  1.1   1:23   0 spamd
20823 root      17   0 27748  22M  8272 S     0.0  1.1   2:45   0 spamd
20871 root      19   0 28432  21M  7908 S     0.0  1.0   2:23   0 spamd
 4095 defang    18   0 16876  16M  2036 S     0.0  0.8   0:01   0
mimedefang.pl

RSS field is the "resident size" or the programs current physical ram
use (if this ever falls below the program's working set, then you get
thrashing).  The SIZE field (VSIZE on FC3) indicates the total memory
use, which is really swap+resident.  SHARE means shared memory, but that
can't be counted against the totals.

I'm sure that there are scripts that exist, but I don't know of any
particular one.

Michael

> 
> Thanks for all the input.
> 
> Greg
> 
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
-- 
Michael Torrie <torriem at chem.byu.edu>




More information about the PLUG mailing list