Help with memory usage

aragonx at dcsnow.com aragonx at dcsnow.com
Thu Jan 10 19:49:20 UTC 2008


I have a server that has 32G of physical memory and 10G of swap space. 
Routinely during the day, always around the same time, it will gradually
go to ~80% swap space usage.

Using Hotsanic, I can see that this percentage of swap space usage has
been gradually increasing over the months.  About a year ago, it was at
~50% so now I'm becoming alarmed.

The simple solution (which I will be doing in any case) is to add more
swap space.  This does fix the memory issue but I fear there are some
performance implications that I have yet to hear about from my users.

So, I wrote a program that I thought would gather the amount of memory
used by my key applications (being Oracle and Java) and display it for me.
 The idea was flawed because of shared memory.  I have yet to devise a way
around this issue and that is where I could use some help.

Here is the program for informational purposes:

TOTAL=0

if [ $1 = "" ]
then
   echo "You must enter the program you wish to find out the memory usage
for."
fi

ps -ef|grep $1|grep -v grep|tr -s " "|cut -d " " -f2 >
/tmp/will_memory_usage.txt

exec 3< /tmp/will_memory_usage.txt
until [ $done ]
do
   read <&3 line
   if [ $? != 0 ]; then
      done=1
      continue
   fi
   PROCVERT=`cat /proc/$line/status|grep VmSize|tr -s " "|cut -d " " -f2`
   let TOTALVERT=TOTALVERT+PROCVERT

   PROCREAL=`cat /proc/$line/status|grep VmRSS|tr -s " "|cut -d " " -f2`
   let TOTALREAL=TOTALREAL+PROCREAL
done

echo "$1 virtual memory usage is $TOTALVERT."
echo "$1 real memory usage is $TOTALREAL."
let TOTAL=TOTALREAL+TOTALVERT
echo " "
echo "Total $1 memory usage is $TOTAL."

rm /tmp/will_memory_usage.txt



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the fedora-list mailing list