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

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux