We can find out the reason behind application slowness by analyzing the Thread Dump in Java world. Thread dumps are also very useful to analyze and troubleshoot performance related issues such as server hang, deadlocks, slow running, idle or stuck applications, slow database interactions etc.

The thread dump is a snapshot of exactly what’s executing at a moment in time.

Following are various method we can try to collect the thread dump in weblogic

WebLogic Server (WLS) and Java offer several ways to generate thread dumps, which are listed below in order of preference. It is always better to obtain the thread dumps by using operating system (OS) commands rather than by using Java classes or the Administration Console, because if the console is hanging, users won’t be able to connect to it to issue thread dumps.

Method 1. Use operating system commands to get the thread dumps when WLS starts up from a command-line script:
On Windows OS, thread dumps can be created by

<ctrl>+<break> in console -- the thread dumps are generated in the server stdout

On POSIX-compliant platforms (e.g. Solaris and Linux), first identify the process ID (pid) using

ps -ef | grep java

then run

kill -3 <pid> 2>&1

Signal 3 is equivalent to SIGQUIT. Note that in Solaris, the thread dump is generated in the current shell, but in Linux, the thread dump is generated in the shell which started the java process specified by the pid.

Method 2. Using beasvc:

beasvc -dump -svcname:<service_name> -log:<td_pathname>

service_name is the Windows service that is running the server instance (e.g.mydomain_myserver)
td_pathname is the full path and the name of the file in which the thread dump will be generated into

Method 3. Using weblogic.WLST:

java weblogic.WLST

The thread dump will be generated in Thread_Dump_AdminServer.txt.

Method 4. From a command line or shell, a thread dump can be generated via the following command (deprecated from WLS 9.0):

java weblogic.Admin <url>:<port> -username <username> -password <password> THREAD_DUMP

The thread dump will be generated in the defined server stdout.

Method 5. From the WLS Administration Console, a thread dump can be created by navigating to
Server -> -> Monitoring -> Dump threads stack.
This method could lead to truncated or incomplete thread dumps.

Method 6. From the JRockit command line:

jrcmd <pid> print_threads
Different ways to take thread dumps in WebLogic Server
Tagged on:                                                                     

Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recommend on Google