Re: Help with memory usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2008-01-10 at 14:49 -0500, aragonx@xxxxxxxxxx wrote:
> 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

Change:

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

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

The second > will cause the line to be appended to the file rather than write a single line file.

Regards,
Les H


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux