How to locate Java threads with high CPU usage

Source: Internet
Author: User
Tags cpu usage high cpu usage

How to locate Java threads with high CPU usage

Tools:

1

Jstack:jstack is used to print the Java stack information for a given Java process ID or core file or remote Debugging service, if it is on a 64-bit machine, you need to specify the option "-j-d64", The Jstack usage of Windows only supports the following way.

pidstat : pidstat is primarily used to monitor all or specified processes that consume system resources, such as CPU, memory, device IO, task switching, threading, and so on. Pidstat displays statistics from the start of the system startup at the first run, and then runs Pidstat displays statistics from the last time the command was run. Users can obtain the required statistics by specifying the number and time of the statistics.

top: or JPS find the Java process PID, or   or  ps-lfp  pid

Use%CPU and time to determine the consumed thread tid

Find the TID, convert it to 16 binary, and then search in the file above (Jstack process ID > Ps.txt) to export, you can navigate to the specific thread, class.


2, or:

Jstack-l pid >/home/1.tdump

Again by looking at threads: pidstat-p PID (Java process id)-u-d-t-w-H 1 1000

Find the TID, convert it to 16 binary, and then search in the file above (Jstack process ID > 1.tdump) to export, you can navigate to the specific thread, class.

3, can download 1.tdump to local search

How to locate Java threads with high CPU usage

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.