SUMMARY:Memory consumption script

From: <Robert.Barkhymer_at_rcn.net>
Date: Thu Dec 06 2001 - 09:28:57 EST
QUESTION:
I have an E4500 Solaris 8 Server with 3 Gig of memory. The server has been
up for over 6 months with no problems. The free memory is slowly being used
up and we are down to 362M. I have checked all the processes being used and
killed some old oracle and user processes. I know rebooting will bring the
free memory back up but I want to avoid this since it is our main
production server. The question is does anyone have a script to take a
snapshot of the total memory being used for certain processes at a certain
time? For instance, I would set a cron to take a snapshot every hour of the
total memory being consumed by all oracle processes(added together).
I have been working with top -osize, vmstat and a ps -e -orss to write a
scripy with awk.  I am hoping that I will be able to see what is slowly
using up the memory.  Any suggestions?

Current stats look like this.
Memory:3072M real, 362M free, 3896M swap in use, 1391 swap free

COMMENTS:
Thanks to all that responded.
I recieved a few good tips on finding total memory of all users like prstat
-ssize -a -n 1,15 1 1 that I recieved from Mathias K. But, I guess what I
really need is a script to find the total memory of certain process that a
user is running. For example: If user Joesmow has 5 oracle processes
running and three parse processes, what is the total memory being consumed
by oracle and the total for parse for user Joesmow? I will continue working
on this script.

But the overall consensus is that this is okay (See a few of the responses
below):

1.)Probably there is no problem, and Solaris is using the memory
for cacheing. There is something in the FAQ about it.

2)Free memory is _supposed_ to approach zero on a machine that's been
running
for awhile - that's how it works.  Any free memory (i.e., memory not used
directly by processes) is used for file caching.  It's a feature =)  The
page scan rate ('sr' column in the vmstat output) is the only good
indication of an actual memory shortage - if 'sr' is consistently above 400
or so (AFAICR), it's an indication that there is an actual memory shortage
and the memory subsystem is actively scanning for pages to swap out.
"The Memory Go Round" is a bit dated, but still quite good:
http://sunsite.nstu.nsk.su/sunworldonline/swol-05-1997/swol-05-perf.html

3)The free memory will always decrease to around 3% of total.
The important thing is to avoid excessive paging.
do a vmstat 1 100 and look for loads of activity in the 'sr' column.  That
is the scan rate - the rate at which it is reclaiming free memory.

4)high memory usage is normal. It's because processes reserve blocks of
memory and so does the filesystem cache.
It's not something to worry about at all, since solaris frees it up as
needed.
http://sunsolve.sun.com/pub-cgi/show.pl?target=content/content8

5)Instead of concentrating on the apparent usage numbers, check to see if
you're
actually short on memory. Does your machine swap to disk? Check the vmstat
"sr"
column.
Don't worry. Be happy. You machine is working correctly.
=> Current stats look like this.
=> Memory:3072M real, 362M free, 3896M swap in use, 1391 swap free
Looks fine to me.

Thanks again!
Received on Thu Dec 6 14:28:57 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:37 EDT