get top 5 i/o busy session
Posted in 2011
Topics: General Discussion
How to get top 10 i/o busy session by running
'onstat -u' and order by " nreads+nwrites" column that addition
values of "nreads and nwrites"
onstat -u | sort -rnk9 | head -n5will get top 5 nreads sessions
onstat -u | sort -rnk10| head -n5will get top 5 nwrites sessions
Is this what you want:
onstat -u|awk '{print $0, ($9+$10)}'|sort -rnk11|head -n 10
On Sat, Jan 29, 2011 at 4:51 PM, joe <joeclhua@gmail.com> wrote:
> How to get top 10 i/o busy session by running
> 'onstat -u' and order by " nreads+nwrites" column that addition
> values of "nreads and nwrites"
>
> onstat -u | sort -rnk9 | head -n5> will get top 5 nreads sessions
>
> onstat -u | sort -rnk10| head -n5> will get top 5 nwrites sessions
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
We wrote a dirty little script we call "top10", called from the shell
as per the usage() statement:
usage()
{
echo "usage: top10 chunkio|chunkr|chunkw|mem|userrd|
userwr"
sleep
3
exit
}
case $#
in
1)
break;;
*)
usage;;
esac
getmemstats()
{
onstat -g ses|sort -n -r -k 7|head|grep "^[0-9]"|
\\
awk '{printf "%8s %8s %8s %8s %8s\\n", $1, $2, $4, $7, $8 }' >
t1.out echo SID USER PID TOTMEM USEDMEM PROCESS |awk '{printf "%10s %10s
%10s %10s %10s %20s\\n", $1, $2, $3, $4, $5,
$6 }'
while true;
do
dataline=`line`
[ $? -ne 0 ]&&
break
set
$dataline
if [ $3 -lt
0 ];then
proc=UNKNOWN
else
proc=`ps -fp$3|grep -v "PPID"|awk '{print
$NF}'`
fi
echo $1 $2 $3 $4 $5 $proc|awk '{printf "%10s %10s %10s %10s
%10s %20s\\n", $1, $2, $3, $4, $5,
$6 }'
done <
t1.out
rm
t1.out
}
case $1
in
chunkio)
# chunk usage by overall I/
O:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k6|
head;;
chunkr)# chunk usage by
reads:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k4|
head;;
chunkw)# chunk usage by
writes:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k5|
head;;
mem)
#Memory
getmemstats;;
userrd)
# User Read
Activity
onstat -u|egrep -v " informix |Informix Dynamic|Userthreads|^$|address
"|sort -n -r -k 9|
head;;
userwr)# User Write
Activity
onstat -u|egrep -v " informix |Informix Dynamic|Userthreads|^$|address
"|sort -n -r -k 10|
head;;
*)
usage;;esac