Java View Tomcat thread information

Source: Internet
Author: User

View Thread Information

Tags: thread stack Information log tomcat response

Tomcat sometimes encounters situations in which all operations are slow to respond or have been unresponsive. If the error message is not visible through the log at this time. It may be difficult to analyze the source of the problem.

In this case, you can look at the thread information of Tomcat and see what is going on.

Reference URL https://www.cnblogs.com/shengulong/p/8513652.html

Jstack thread ID to see the stack of a thread, especially for hung dead threads, you can use option-F to force print dump information jstack-f PID

Jstack definition: Jstack is a stack trace tool that comes with Java virtual machines. The thread snapshot used to generate the current moment of the Java virtual machine. A thread snapshot is a collection of method stacks that each thread in the current Java Virtual machine is executing, and the primary purpose of generating a thread snapshot is to locate the cause of a thread's long pauses, such as inter-thread deadlocks, dead loops, long waits to request external resources, and so on.

PS: In the actual operation, often a dump of information, not enough to confirm the problem. It is recommended to generate three dump messages, and if each dump points to the same problem, we determine the typical problem. That is, take a few more threading snapshots, watch the changes, and see where the problem is.

Refer to the command jstack PID >run.log and then open the Run.log file with the attachment "View Thread Log" tool.

Main observations of several states

    1. Deadlock,Deadlock (focus on)
    2. In execution, Runnable
    3. Waiting for resources,waiting on condition (focus)
    4. Waiting to get the monitor,waiting on monitor entry (focus)
    5. Pause, Suspended
    6. Object waits, object.wait () or timed_waiting
    7. Blocking,Blocked (Focus)
    8. Stop, parked.

Then look at which code information each status is anchored to.

View Deadlock

View Monitors

Find the best code for threads


How many occurrences of search in the log file

Java View Tomcat thread information

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.