How to crawl thread dump summary (GO)

Source: Internet
Author: User

When the server hangs, crashes, or is under performance, it needs to crawl the server's thread stack (thread Dump) for subsequent analysis.
Thread dump provides a snapshot of the currently active thread. It provides stack trace information for all Java threads in the JVM
There are many ways to get thread Dump, some of which are operating system-specific commands.


Operating system commands get Threaddump:

Windows:
1. Switch to the standard Output window of the server and press the CONTROL + Break key, then you need to copy the thread stack to the file

Unix/linux

First find the process ID of the server, and then get the stack.

1. Ps–ef | grep java

2. Kill-3 <pid>

Attention must be cautious, one step inadvertently may let the server process be killed!


The JVM comes with a tool to get the thread stack:

The JDK comes with command-line tools to get PID and do threaddump:

1. JPS

2. Jstack <pid>

Using JVISUALVM:

Threads tab àthreaddump button.


WebLogic comes with the tool to get thread dump:

1. Weblogic.admin Tools

A. Open a command prompt and set the related classpath by running <domain_home>/bin/setdomain.env

B. Execute the following command

Java WebLogic. Admin-url t3://localhost:7001-username Weblogic-password Weblogic1 thread_dump

Note: Thread Dump prints to standard output, such as the Nohup log or Process window.

2. Using the Admin Console

A. Login to Admin Console and click on the corresponding server

B. Click Serveràmonitoringàthreads

C. Click: Dump Thread Stack button

3. Using Wlst (WebLogic Scripting Tool)

Connect (' WebLogic ', ' weblogic1 ', ' t3://localhost:7001 ')
CD (' Servers ')
CD (' AdminServer ')
Threaddump ()
Disconnect ()
Exit ()
Note: The thread stack will be saved in the current directory running WLST.

4. Use Utils. Threaddumper

Usage:

C:\BEA\WLSERVER_10.3\SERVER\LIB>JAVA-CP Weblogic.jar Utils. Threaddumper

Broadcast Thread dumps disabled:must specify WEBLOGIC.DEBUG.DUMPTHREADADDR and

Weblogic.debug.dumpThreadPort

Exception in thread ' main ' java.lang.IllegalArgumentException:Port out of range

:-1

At Java.net.DatagramPacket.setPort (Unknown Source)

At java.net.datagrampacket.<init> (Unknown Source)

At java.net.datagrampacket.<init> (Unknown Source)

At Utils. Threaddumper.senddumpmsg (threaddumper.java:124)

At Utils. Threaddumper.main (threaddumper.java:145)


5. If the server is running as a Windows service, run the following command:

Wl_home\bin\beasvc-dump-svcname:service-name


Other tools to get thread dump are jrcmd, JRMC (JRockit VMs), Samurai, Jprofiler, etc., which can also be obtained through JMX programming, such as the JDK's own sample code:

$JAVA _home\demo\management\fullthreaddump

Http://www.blogjava.net/beansoft/archive/2011/12/30/367584.html

Http://blog.sina.com.cn/s/blog_5f53615f0100zllb.html

Http://www.blogjava.net/jzone/articles/303979.html

Http://blog.sina.com.cn/s/blog_6ed93640010114a4.html

How to crawl thread dump summary (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.