Generate Heap and Thread dumps

Take the process id from Running Jboss server and replace below JAVA_PID

jmap -dump:format=b,file=heap.hprof JAVA_PID
jstack -l JAVA_PID > jstack.out

if you want to take 5 dumps with 10 sec interval then script like below and execute

generateDumps.sh 
#/bin/bash
JAVA_PID=<update pid here>
#JAVA_PID=`ps -ef | grep java | grep -v server1 |grep -v grep | awk '{print $2}'`
for i in 1 2 3 4 5 ; do
  echo "taking $i Dump ..." 
  jmap -dump:format=b,file=$i_heap.hprof JAVA_PID 
  jstack -l JAVA_PID > $i_jstack.out
  sleep 10
done

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *