Find out how to troubleshoot the most CPU-intensive threads in your Web project on the LIUNX server

Source: Internet
Author: User

Here is a summary of the steps to find the thread resource consumption problem for Linux, Sun (Oracle) JDK, in Linux, when the Java process is found to occupy a high CPU resource, and want to further find out which Java thread is consuming CPU resources, Follow these steps to find:

First step: Log in to the LIUNX server where the Web service resides, and use the top command to get the CPU usage of Java

Step Two:

As shown, the process ID of Java is ' 3260 ', and the next step is to monitor all threads in this process separately with the top command: Top-p 3260-h

Step Three:

As shown in Linux, all Java internal threads actually correspond to a process ID, which means that the Sun JVM on Linux maps threads in Java programs to operating system processes, and we see that the process ID that consumes the most CPU resources is ' 3740 ', This process ID corresponds to the ' Nid ' (' n ' stands for ' native ') in the Java thread information;

Fourth Step:

To find out exactly which specific code occupies so many resources, first use Jstack to play the current stack of information into a file, such as Mystack.log:jstack 3260 > Mystack.log

Fifth Step:

Convert 3740 to 16 in e9c, find the nid=oxe9c thread in the Mystack.log file, and then troubleshoot the code in that thread

Find out how to troubleshoot the most CPU-intensive threads in your Web project on the LIUNX server

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.