Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory Statistics 1

Status
Not open for further replies.

dlpar

Technical User
Dec 9, 2003
82
FR
Need Help about memory measurements.
[frog]
I have an AIX running WebSphere and DB2.
WebSphere has two JVM Of 1Gb.
I suppose than WebSphere reserve the 2Gb of memory at the start of the Application Server.
[frog]
When I look at the memory of WebSphere I can only see the memory really use by WebSphere.
It's amount 500Mb and not 2Gb (with no activity).
Do you have a method to see the memory reserved by WebSphere.

I am looking at the Parameter SZ of ps, isn’t the good parameter to focus on ?


I use this script to calculate the memory used by all the process of my user WebSphere:
ps auwwx | grep -v defunct | grep WebSphere| awk '{print $5}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes



 
Probably WebSphere uses also IPC structures like shared memory.
To find how much shared mem WebSphere uses you can do:
|
ipcs -ma|awk '( $7 == "WebSphere" ) { x += $10/1024};END {print "Tot Kb of shared mem "x}'
 
Thanks for your answer.
The result is ot Kb of shared mem 363608
I am still far away of the 2Gb of the two JVMs.
 
Probably you should use the VSIZ field.
Try this:
ps -elo "%p %z %U %a"|awk '( $3 == "WebSphere") { x += $2 };END {print "Tot kb of WebSphere procs" x }'
 
There is a little explanation on the problem you have.
If WebSphere doesn't pin all the memory it needs, the not recently used pages are stolen from OS.
Furthermore when AIX loads a program in mem it makes a kind of prediction about the next page of mem which will be used by the loading proc and loads only a subset of all the possible page used by the procs, so if the proc never requires a not present page, this page will be never in RAM.
Who says you that your WebSphere really uses 2 Mb?
 
I am sure than WebSphere use 2Gb because:
- it is the definition in WebSphere for my Application Server
- I got a patrol agent on this machine: Java is consuming 2,4Gb (Java = 2 JVms of my application + WebSphere himself).
- I got a tools named QPASA than say to me than WebSphere is using 2Gb for my application.
[frog]
But, only with UNIX commands, I got problems to measure the 2Gbs.
I find less than one.
 
well dmarais,
there are another chance, using ps with u or v flag you can achieve the %MEM field which yelds the % of memory used by the proc ... or with v flag you probably shoud sum the RSS, the TSIZ and TRS fields ... with a problem the TSIZ field is related to the amount of shared library used.
If the two JVM of yours share the same library probably you will count 2 times the same amount
 
For memory used by procs try this:
ps -ef|awk '( $1 == "WebSphere" ){print $2}'|while read pid
do
ps v |grep -v TTY
done|awk '{ RSS += $7 ;TSIZ += $10 }END{print RSS + TSIZ }'

Should give the global size of WebSphere procs
 
Hi sbix,
That's a really good solution to catch the pid and after to work with it.
I will use this method for other scripts.
But the result of the Global script doesn't give the result that I am looking for.

If I use the value %MEM of ps i got the same value (a little bit more) that with the SZ,RSS...fields.
However, %MEM tends to exaggerate the cost of a process that shares text with other processes

To, I start to think than WebSphere do not really reserve the memory at the start of the application server.
I don't now if my tool patrol is giving me bad information’s or he is looking at a value that I don't no.

I am going to perform bench’s on this machine next week.
This way I will now if I am not looking at the good parameters or if patrol is giving me bad parameters.
I will give some news about the tests next week.


Thanks for your help.

[santa2]
 
Hi dmarais,
I did a bunch of test, comparing the results with the output of topas (if you get a look to the mem fields related to computational pages %Comp)
The only thing which gave the same value was the sum of RSS field (obviously I summed all the RSS fields of all the program in system)
Indeed in the manual the RSS field description is:
RSS
(v flag) The real-memory (resident set) size of the process (in 1KB units).
 
Thanks sbix for you answer an your help.
After multiple test i think than the most interesting value to look at is RSS like you say in your last message.
I done a script to collect all the basics information’s of performance on AIX.
If somebody want to use it:

Sorry, the main panel is in FRENCH:

#!/usr/bin/ksh
#********************************
# performances AIX
#********************************
# variables
Total=0
#
clear
echo "***************************************"
echo "GENERAL"
echo "0: freeware nom64"
echo "1: topas"
echo "2: vmstat 1 10"
echo "******************"
echo "MEMOIRE"
echo "3: taille physique de la RAM"
echo "4: taille du paging space"
echo "5: taux occupation du paging space"
echo "6: RAM occupe par tous les processus"
#echo "7: memoire occupe par tous les processus"
#echo "8: memoire occupe par oracle"
#echo "9: memoire occupe par les processus d'un utilisateur"
echo "10: RAM occupe par les processus identifie par une string de caractere "
#echo "11: memoire occupe les processus d'un utilisateur identifie par une string de caractere"
echo "12: detail memoire occupe par les processus d'un utilisateur"
echo "******************"
echo "CPU"
echo "13: nombre de CPUs"
echo "14: type et frequence des CPUs"
echo "******************"
echo "DISQUES"
echo "15: statisques disques"
echo "16: start et remise a zero des statistiques disque"
echo "17: arret de collecte des statistiques disque"
echo "******************"
echo "VG et LV"
echo "18: statisques VG"
echo "19: statisques LV"
echo "20: start et remise a zero des statistiques d'un VG"
echo "21: arret de collecte des statistiques d'un VG"
echo "***************************************"
read REPONSE
case $REPONSE in
0)
echo ""
/usr/sbin/chdev -l sys0 -a iostat=true
echo "appuyer sur enter quand vous etes ready"
echo "appuyer sur q pour quitter les stats"
read
/sma/sys/bin/nmon64
/usr/sbin/chdev -l sys0 -a iostat=false
;;
1)
echo ""
echo "appuyer sur enter quand vous etes ready"
echo "appuyer sur q pour quitter les stats"
read
topas
;;
2)
echo ""
vmstat 1 10
;;

3)
echo ""
echo "taille physique de la RAM"
RAM=`lsattr -El mem0 | grep Total |awk '{print $2}'`
echo " $RAM Mb"
;;
4)
echo ""
echo "taille du paging space"
PAGING=`lsps -a | grep -v Auto | awk '{print $4}'`
echo " $PAGING"
;;
5)
echo ""
echo "taux oocupation du paging space"
PAGING=`lsps -a | grep -v Auto | awk '{print $5}'`
echo " $PAGING %"
;;
6)
echo ""
echo "RAM occupe par tous les processus"
ps auwwx | grep -v defunct | grep -v COMMAND| awk '{print $6}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
7)
echo ""
echo "memoire occupe par tous les processus"
ps auwwx | grep -v defunct | grep -v COMMAND| awk '{print $5}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
8)
echo ""
echo "memoire occupe par oracle"
ps -f -l -u oracle | grep -v defunct | grep -v WCHAN| awk '{print $10}' | while read line
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
9)
echo ""
echo "taper le nom de utilisateur cible"
echo "appuyer ensuite sur enter"
read USER
echo ""
echo "memoire occupe par les processus de utilisateur $USER"
ps -f -l -u $USER | grep -v defunct | grep -v WCHAN| awk '{print $10}' | while read line
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
10)
echo ""
echo "taper la string de caractere"
echo "appuyer ensuite sur enter"
read STRING
echo ""
echo "RAM occupe par les processus identifie par la string de caractere $STRING"
ps auwwx | grep -v defunct | grep $STRING| awk '{print $6}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
11)
echo ""
echo "taper le nom de utilisateur cible"
echo "appuyer ensuite sur enter"
read USER
echo ""
echo "taper la string de caractere"
echo "appuyer ensuite sur enter"
read STRING
echo ""
echo "memoire occupe par les processus de utilisateur $USER identifie par la string $STRING"
ps -f -l -u $USER | grep -v defunct | grep -v WCHAN| grep $STRING |awk '{print $10}' | while read lin
e
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
12)
echo ""
echo "taper le nom de utilisateur cible"
echo "appuyer ensuite sur enter"
read USER
echo ""
svmon -d -U $USER | more
;;
13)
echo ""
CPU=`lsdev -C | grep proc | grep -v grep | grep Available | wc -l`
echo "Le nombre de CPUs disponibles sur la machine est $CPU"
;;
14)
echo ""
numProc=$(lsdev -C | grep proc | awk '{print $1}')
uniProc=`echo $numProc | awk '{print $1}'`
TYPE=`lsattr -El $uniProc | grep type | awk '{print $2}'`
echo "le type de processeur est $TYPE"
FREQ=`lsattr -El $uniProc | grep freq | awk '{print $2}'`
echo "la frequence de processeur est $FREQ Hz"
;;
15)
echo ""
iostat -s
;;
16)
echo ""
chdev -l sys0 -a iostat=false
chdev -l sys0 -a iostat=true
;;
17)
echo ""
chdev -l sys0 -a iostat=false
;;
18)
echo ""
echo "taper le nom du Volume Group"
echo "exemple: rootvg"
echo "appuyer ensuite sur enter"
read VG
lvmstat -v $VG
;;
19)
echo ""
echo "taper le nom du Logical Volume"
echo "exemple: hd6"
echo "appuyer ensuite sur enter"
read VG
lvmstat -l $VG
;;
20)
echo ""
echo "taper le nom du Volume Group"
echo "exemple: rootvg"
echo "appuyer ensuite sur enter"
read VG
lvmstat -d -v $VG
lvmstat -e -v $VG
;;
21)
echo ""
echo "taper le nom du Volume Group"
echo "exemple: rootvg"
echo "appuyer ensuite sur enter"
read VG
lvmstat -d -v $VG
;;


*)
echo "pas de requette correspondant a votre demande"
;;
esac



 
A quick translation in ENGLISH.
Sorry for the spelling.

#!/usr/bin/ksh
#********************************
# performances AIX
#********************************
# variables
Total=0
#
clear
echo "***************************************"
echo "MAIN"
echo "0: freeware nom64"
echo "1: topas"
echo "2: vmstat 1 10"
echo "******************"
echo "MEMORY"
echo "3: SIZE OF THE RAM"
echo "4: SIZE OF THE paging space"
echo "5: % paging space"
echo "6: SIZE OF THE RAM used by all proces"
#echo "7: memoire occupe par tous les processus"
#echo "8: memoire occupe par oracle"
#echo "9: memoire occupe par les processus d'un utilisateur"
echo "10: SIZE OF THE RAM by ALL the PROCESS than are inclued in a string of caracter "
#echo "11: memoire occupe les processus d'un utilisateur identifie par une string de caractere"
echo "12: MEMORY DETAILS for the process of an user"
echo "******************"
echo "CPU"
echo "13: nomber of CPUs"
echo "14: type and frequency "
echo "******************"
echo "DISKS"
echo "15: statistics"
echo "16: start of statistics"
echo "17: stop of statistics"
echo "******************"
echo "VG et LV"
echo "18: statistics VG"
echo "19: statistics LV"
echo "20: start of statistics VG"
echo "21: stop of statistics VG"
echo "***************************************"
read REPONSE
case $REPONSE in
0)
echo ""
/usr/sbin/chdev -l sys0 -a iostat=true
echo "press enter when you are ready"
echo "press q to quit"
read
/sma/sys/bin/nmon64
/usr/sbin/chdev -l sys0 -a iostat=false
;;
1)
echo ""
echo "press enter when you are ready"
echo "press q to quit"

read
topas
;;
2)
echo ""
vmstat 1 10
;;

3)
echo ""
echo "size of the RAM"
RAM=`lsattr -El mem0 | grep Total |awk '{print $2}'`
echo " $RAM Mb"
;;
4)
echo ""
echo "size of the paging space"
PAGING=`lsps -a | grep -v Auto | awk '{print $4}'`
echo " $PAGING"
;;
5)
echo ""
echo "% paging space"
PAGING=`lsps -a | grep -v Auto | awk '{print $5}'`
echo " $PAGING %"
;;
6)
echo ""
echo "RAM occuped by all proces"
ps auwwx | grep -v defunct | grep -v COMMAND| awk '{print $6}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
7)
echo ""
echo "MEMORY used by all process"
ps auwwx | grep -v defunct | grep -v COMMAND| awk '{print $5}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
8)
echo ""
echo "memory used by oracle"
ps -f -l -u oracle | grep -v defunct | grep -v WCHAN| awk '{print $10}' | while read line
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
9)
echo ""
echo "name of the user"
echo "after press enter"
read USER
echo ""
echo "memoire occupe par les processus de utilisateur $USER"
ps -f -l -u $USER | grep -v defunct | grep -v WCHAN| awk '{print $10}' | while read line
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
10)
echo ""
echo " string of caracter"
echo "after press enter"
read STRING
echo ""
echo "RAM occuped by procesidentified by a string of caracter $STRING"
ps auwwx | grep -v defunct | grep $STRING| awk '{print $6}' | while read line
do
Size=`echo $line`
if [ ! -z "$Size" -a "$Size" -ge 0 ]
then
((Total=Size+Total))
fi
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
11)
echo ""
echo "enter the name of the user"
echo "press enter"
read USER
echo ""
echo "string of caracter"
echo "press enter"
read STRING
echo ""
echo "memory used by process of user $USER identified by string $STRING"
ps -f -l -u $USER | grep -v defunct | grep -v WCHAN| grep $STRING |awk '{print $10}' | while read lin
e
do
Size=`echo $line`
((Total=Size+Total))
done
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
;;
12)
echo ""
echo "enter the name of the user"
echo "press enter"
read USER
echo ""
svmon -d -U $USER | more
;;
13)
echo ""
CPU=`lsdev -C | grep proc | grep -v grep | grep Available | wc -l`
echo "number of CPUs avalaible is $CPU"
;;
14)
echo ""
numProc=$(lsdev -C | grep proc | awk '{print $1}')
uniProc=`echo $numProc | awk '{print $1}'`
TYPE=`lsattr -El $uniProc | grep type | awk '{print $2}'`
echo "type of CPU is $TYPE"
FREQ=`lsattr -El $uniProc | grep freq | awk '{print $2}'`
echo "frequency of CPU is $FREQ Hz"
;;
15)
echo ""
iostat -s
;;
16)
echo ""
chdev -l sys0 -a iostat=false
chdev -l sys0 -a iostat=true
;;
17)
echo ""
chdev -l sys0 -a iostat=false
;;
18)
echo ""
echo "name of the VG"
echo "exemple: rootvg"
echo "after press enter"
read VG
lvmstat -v $VG
;;
19)
echo ""
echo "name of the Logical Volume"
echo "exemple: hd6"
echo "after press enter"
read VG
lvmstat -l $VG
;;
20)
echo ""
echo "name of the Volume Group"
echo "exemple: rootvg"
echo "press enter"
read VG
lvmstat -d -v $VG
lvmstat -e -v $VG
;;
21)
echo ""
echo "name of the Volume Group"
echo "exemple: rootvg"
echo "after press enter"
read VG
lvmstat -d -v $VG
;;


*)
echo "no record for this choice"
;;
esac
[worm]
 
Here is a simple way (2 lines0 to get all memory used by an app
##
ps aux | grep -v USER > /tmp/gmem.out
awk '{ sum+=$6 } END { print "Total Real Memory Used =",sum}' /tmp/gmem.out
##
This gets RSS memory but you could adjust, look into svmon its a great tool for what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top