How to take Thread dumps from IBM Websphere


Here are ways get the thread dump for your Websphere (WAS) server for performance analysis.



The most reliable way to generate a thread dump in WAS is using wsadmin utility and through Script . The steps for the same are as follows:



Generating Thread dump using wsadmin utility


  • Navigate to the bin directorycd <was_root>/profiles/<PROFILE_NAME>/bin/
  • Connect to deployment manager using wsadmin script wsadmin.bat -conntype SOAP -username -password 
  • The above command opens a wsadmin prompt. Now set the object variable to be used for generating the dumps wsadmin> set jvm [$AdminControl completeObjectName type=JVM,process=,node=,*]
  • Run this command: 
    wsadmin> 
    $AdminControl invoke $jvm dumpThreads
  • If you want to force heap dump, run the following command: 
    wsadmin> 
    $AdminControl invoke $jvm generateHeapDump

Besides, if you have unix based systems like Linux/Mac, you can generate threaddump by just running the command:
kill -3 <pid>.

use ps -ef | grep java or ps -ef | grep to get the process-id(pid).

If you run WAS in console mode in Windows, Ctrl+Break helps to generate the dump but I have never tried it before.

For more details Please check following Post “How to take thread dumpfrom different OS

A sample for generating a thread dump in a machine with node 5184Node01 and hosted locally in port 9443 with user/pass (ADMIN/password) is as follows:

wsadmin.bat localhost 9443 -username ADMIN -password password

The following commands will be run in wsadmin prompt.

set jvm [$AdminControl completeObjectName type=JVM,process=server1,node=5184Node01,*]
$AdminControl invoke $jvm dumpThreads
Generating thread dump using WSAdmin script

You can generate Thread Dump or Java core manually using the following WSAdmin Script

def generateThreadDump(serverName):
serverJVM = AdminControl.queryNames("type=JVM,process="+serverName+",*")
AdminControl.invoke(serverJVM,"dumpThreads")

generateThreadDump("server1") 

The generateThreadDump() method takes server name and generates thread dump for that server. Once the thread dump is generated you can find out the location of the thread dump from native_stderr.log file.




 

Post a Comment

0 Comments