Java Process CPU Soar high

Source: Internet
Author: User

Because it's been being monitored for a while, but the work is still in progress.

Because the machine is not many, so this morning patrol, saw a production machine on the high CPU

Top

And then you get out of the great God tool JVM

Introduction to the specific JVM look: http://www.cnblogs.com/smail-bao/p/6027756.html

If the CPU is high, we're using jstack tools.

First we use top to find out which process is causing the CPU to soar high

Here we see a process with PID number 11506

What is the project for this process (in order to send the wrong location to the relevant developer), using Ps-aux | grep PID

But how do we target specific threads or code?

The list of threads is displayed first:

PS-MP Pid-o Thread,tid,time

From here we can find the highest consuming thread 11508, which takes up more than a minute of CPU time.

Here we then convert the thread's TID to 16, using the following method

printf "%x\n" tid

From here we can see that the hexadecimal corresponding to the thread is 2CF4

Last print thread's stack information:

Jstack PID | grep tid-a100

And then we send this piece of content to the corresponding development, and he can locate his problem.

Finally, summarize the methods and techniques for troubleshooting CPU failures:

1. Top command: Linux command. You can view real-time CPU usage. You can also view CPU usage for the most recent period of time.

2, PS command: Linux command. Powerful process status monitoring commands. You can view the current CPU usage of the process and threads in the process. The sampled data that belongs to the current state.

3, the Jstack:java provides the command. You can view the current thread stack run of a process. Depending on the output of this command, you can locate the current running state of all threads of a process, run code, deadlock, and so on.

4, Pstack:linux command. You can view the current thread stack run of a process.


Article turned from: http://blog.csdn.net/blade2001/article/details/9065985

Java Process CPU Soar high

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.