Operating System - HP-UX
1847474 Members
2955 Online
110265 Solutions
New Discussion

Re: Memory comsuption analisis

 
SOLVED
Go to solution
Arturo_5
Advisor

Memory comsuption analisis

Hellow folks,

Actually we are experience high memory consumption in our enviroments, it is composes by rp74XX server (8 GB Ram + 16 swap, swapmem_on=0), oracle 9i and internal apps.

With the out put of ps -el command i tried to analize the most memory consumption process (i attached the out put), i have assumed that the argument SZ is the total resident memory (physical memory) that is used by the process, however when add everything what the processes occupy (all SZ process) this don´t match with the physical memory installed in the machine.

How can i detect truly the physical memory that a process is using from command line ??

Than
10 REPLIES 10
Geoff Wild
Honored Contributor

Re: Memory comsuption analisis

Here's a little script for you:

#!/bin/sh
# processmem - display memory claimed by a process
#
if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "processmem \"process\""
echo "Example:"
echo "processmem rpc"
exit 1
fi
echo " "

PROCESS=$1

mps=0
#for sz in `ps -elf | grep $PROCESS | grep -v grep | awk '{print $10}'`
for sz in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -rnk1 | grep -v Kbytes | grep $PROCESS | awk '{print $1}'`
do
mps=`expr $mps + $sz`
done
#echo `expr $mps \* 4096`
echo "\nMemory claimed by $PROCESS: $mps Kbytes.\n"


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sridhar Bhaskarla
Honored Contributor

Re: Memory comsuption analisis

Hi,

You won't get the number from the ps output as buffer cache and the systems' dynamic pool is not added in there. A better command to use is

UNIX95= ps -e -o 'vsz pid args' |sort -n

I suggest you use 'glance' to figure it out. In the memory windows section, it is neatly laid out on how the memory is split like System Memory, User Memory, Buffer cache, Free memory etc.,

I would first check the buffer cache settings on your system. If you haven't changed it, then it may be set to 50% which is a overkill. Post the following.

#kmtune -l -q dbc_max_pct
#kmtune -l -q dbc_min_pct
#kmtune -l -q nbuf
#kmtune -l -q bufpages

If you find it at 50% (dbc_max_pct), then Is uggest you reduce it down to 5-8% to get around 400MB - 600 MB.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Bill Hassell
Honored Contributor

Re: Memory comsuption analisis

ps gives a very simple listing of process memory. It gives you no information about shared memory (use: ipcs -bmop), no information about shared libraries, no information about the buffer cache and no information about the kernel's memory usage. If you have not changed the buffer cache limits, massive amounts of RAM can be used there. This will sort all the processes into the amount of memory used, largest first:

UNIX95= ps -eo vsz,pid,ruser,args | sort -rn

HP-UX uses memory (like most Unix versions) in many different ways. To get a good picture of memory usage, you'll need to purchase GlancePlus.


Bill Hassell, sysadmin
Arturo_5
Advisor

Re: Memory comsuption analisis

Thanks folks,

I suggest the use of glance, but in this case i get other problem cause the process list only give me a short view of the all process runing on the machine.. How can i get the complet process view from glance.

Arturo
Sridhar Bhaskarla
Honored Contributor

Re: Memory comsuption analisis

Hi Arturo,

What you got is correct. The "vsz" portion of the ps output using UNIX95 gives you the core image in KB.

However, you should not try to add up these numbers to get the total memory used as this number doesn't include shared memory and memory mapped areas. And there is buffer cache.

If you are really interested to know how the memory regions are mapped for a particular process, find out the 'pid' of the process (you can use UNIX95= command), open up glance and press "M". Enter the pid of the process and it will show the Memory regions for that process.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Arturo_5
Advisor

Re: Memory comsuption analisis

Ok,

Do you have any recomendations in order to obtain a memory mapped of my systems at just time. this will help us to determine wich are the process that are consumming the memory.

If you have any ideas over it, let me know.

Thanks
Navin Bhat_2
Trusted Contributor

Re: Memory comsuption analisis

Could you please re-phrase your question again? I am not sure I understand what you need exactly.
Sanjay_6
Honored Contributor
Arturo_5
Advisor

Re: Memory comsuption analisis

Sanjay,

thanks... I can not access to this document.. the page can not find the document ID.. could you attach the file ?

Regards
Bill Hassell
Honored Contributor
Solution

Re: Memory comsuption analisis

Glance will list all the proceses in the system if you want. When you are analyzing performance in realtime, you usually don't want to look at uninteresting processes like getty and shells waiting for user input. But you can override Glance's 'interesting process' limits. Start the program, type the letter o (as in o-verride) -- no CR/Enter, just the character o. Then select the Process option by pressing Enter or the number 1 followed by Enter. Change the first 3 lines to all zeros. Then tab down to Sort key and select rss (for memory). Select Perform Task and you'll be sent to the g window. The bottom righthand edge will show something like Page 1 of 35. Then use f to go forward, b to go backward.

Personally, anything less than 5% CPU or 5% I/O is not of any interest to me so I set the o screen options to: CPU=5, I/O=5, RSS=999999 and then sort by cpu or disk. Now I only see the interesting processes.

To see every process in a file, use the UNIX95 constructs mentioned above.


Bill Hassell, sysadmin