Analyzing which thread in the Java process consumes a lot of CPU processing time

Source: Internet
Author: User

Here are the detailed steps:
1. First determine the ID of the process, you can use the jps-v or the top command to view directly
2. To see which thread in the process is consuming a large number of CPUs, execute Top-h-p [PID] results as follows:

You can find a total of 9 threads numbered 350xx occupy 100% of the CPU, OK, next we take a random thread ID, suppose we want to see the number 35053 this thread.

First turn 35053 into 16 binary is 88ED (can be converted with open source China online tool)
3. Next we output all threads in the process to a file, executing: jstack [PID] > Jstack.txt
4. Find the corresponding thread ID in the process, execute: Cat Jstack.txt | Grep-i 88ED
The result is:
"HTTP Request from:/xxxx/blog/323432 (120.27.143.239)" #266 daemon prio=5 os_prio=0 tid=0x00007fcda4146800 nid=0x88e Run nable [0x00007fcd54178000]
As a result, when the/xxxx/blog/323432 link is requested, the server's processing thread consumes 100% of the CPU.

Analyzing which thread in the Java process consumes a lot of CPU processing time

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.