Call Me at +91 7798846928 for Trainings

My photo
I am a Middleware Trainer and Consultant for Websphere (WAS, MQ), Weblogic, SOA and JBOSS Administration. Drop a mail to kvn@live.in for trainings and videos or call on +91 7798846928 for details.

Sunday, February 23, 2014

How to generate Thread Dumps manually in Websphere Application Server 7 and analyze?

Application Server is nothing but a Java process. And as you are aware Java language supports multi-threding concept. The class file (could be a POJO/Servlet/JSP) whichever receives the request will decide what method  (also called as functions in other programming languages) of that class will handle the request. Once the appropriate method is engaged (to process the business logic/control commands), a thread id is assigned to it. In a similar fashion, many java threads will process in parallel thereby enabling multi-threading in Java on Websphere Application Server's JVM (server basically). In order to take a look at the objects (object is a variable in system memory which holds the end to end methods/variables being called for a particular java class) status currently the Heap memory allocated to JVM occupies we can generate a thread dump. A thread dump will detail the java methods currently under execution on a running JVM, and its execution time.

 

When/Why do we need to take thread dumps manually?

1.  To analyze the application server response time for a method call.
2.  To identify the root cause of an application server hang/thread hangs.
3.  To scrutinize the under-performing application server and suggest heap corrections or application performance issues with development team.

How to take thread dumps manually ?

There are 2 approaches in this category:
1.    In Linux/Unix/AIX/HP-UX/Solaris platforms, use "kill -3 <PID>" to generate thread dumps from OS level.

2.    You can do this from Websphere supplied wsadmin commands to generate one as well!
Navigate to Application server's profile_home bin directory and execute wsadmin command as shown below:
<WAS_HOME>\profiles\<profilename>\bin# ./wsadmin.sh -username XXX -password XXXX

$AdminControl invoke $JVMNAME dumpThreads 
Ex: wsadmin> $AdminControl invoke Server1 dumpThreads

At wsadmin prompt use the above command with JVMNAME = application server name as it appears in logs folder for this profile. Thread dump will be generated here under the bin folder or under profile_home or logs folder of that profile.

How to analyze a thread dump ?

"IBM Thread and Monitor dump analyzer for java" is the tool provided by IBM alphaworks developers portal. Download it and use it. The tool's built-in help notes will detail the options available in just a few steps. It is the most simple tool for thread analysis. There are many other analyzer tools available other than this. It is purely a matter of choice.

After reading this blog post kindly proceed with below link, to better understand automation of thread dumps.

How to automate Thread Dumps in Websphere Application Server ?

3 comments: