Good to see posting some article on my blog after a long gap :)
Today I will explain on a very simple but important area needed for performance monitoring and analysis. This article is related to thread dump collection during performance execution in unix.
Topic: "How to collect thread dumps from CLI in Unix at regular interval"
Uuh... looks very simple post.. isn't it...!!! YES IT IS...
Use below command to capture thread dumps every 5 min:
nohup ./get_jstack [Output-Log-Dir] 300 > /dev/null 2>&1 &
Now let's see what are the content of "get_jstack" file:
#!/bin/bash
LOGDIR=$1
WAIT=$2
mkdir $LOGDIR/serverjstack; mkdir $LOGDIR/muxjstack; mkdir $LOGDIR/wdjstack;
i=1
while [ $i -gt 0 ]
do
PID1=`cat $LOGDIR/xmppd.pid`
/usr/jdk/latest/bin/jstack $PID1 > $LOGDIR/serverjstack/jstack$i
PID2=`cat $LOGDIR/mux.pid`
/usr/jdk/latest/bin/jstack $PID2 > $LOGDIR/muxjstack/jstack$i
PID3=`cat $LOGDIR/wd.pid`
/usr/jdk/latest/bin/jstack $PID3 > $LOGDIR/wdjstack/jstack$i
sleep $WAIT
echo $i
i=`expr $i + 1`
done
Make sure you provide the absolute path of jstack file. serverjstack, muxjstack and wdjstack are the folders for 3 processes which are running on the unix machine.
here you go.. jstack will be created in the folder that you pass from command line.
Enjoy Analyzing Thread Dumps For Performance Bottlenecks...
More to come soon.... :)
Today I will explain on a very simple but important area needed for performance monitoring and analysis. This article is related to thread dump collection during performance execution in unix.
Topic: "How to collect thread dumps from CLI in Unix at regular interval"
Uuh... looks very simple post.. isn't it...!!! YES IT IS...
Use below command to capture thread dumps every 5 min:
nohup ./get_jstack [Output-Log-Dir] 300 > /dev/null 2>&1 &
Now let's see what are the content of "get_jstack" file:
#!/bin/bash
LOGDIR=$1
WAIT=$2
mkdir $LOGDIR/serverjstack; mkdir $LOGDIR/muxjstack; mkdir $LOGDIR/wdjstack;
i=1
while [ $i -gt 0 ]
do
PID1=`cat $LOGDIR/xmppd.pid`
/usr/jdk/latest/bin/jstack $PID1 > $LOGDIR/serverjstack/jstack$i
PID2=`cat $LOGDIR/mux.pid`
/usr/jdk/latest/bin/jstack $PID2 > $LOGDIR/muxjstack/jstack$i
PID3=`cat $LOGDIR/wd.pid`
/usr/jdk/latest/bin/jstack $PID3 > $LOGDIR/wdjstack/jstack$i
sleep $WAIT
echo $i
i=`expr $i + 1`
done
Make sure you provide the absolute path of jstack file. serverjstack, muxjstack and wdjstack are the folders for 3 processes which are running on the unix machine.
here you go.. jstack will be created in the folder that you pass from command line.
Enjoy Analyzing Thread Dumps For Performance Bottlenecks...
More to come soon.... :)


