There are some scenarios or during issue checking with Vendor for memory analysis we need to collect the sequence of Heap dumps and share . Below script will help to achieve that .
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
No comments:
Post a Comment