Under high CPU Linux server

When the server reported cpu is too high, use the following command, quickly export the stack information for easy viewing specific problems.

Use the top command to locate abnormal process. You can see the 12836 CPU and memory usage are very high

At this point you can then execute ps -ef | grep java, java see all the processes, find the process ID for the process 12836 in the results to see which application is occupied by the process.

We use top -H -p process ID to view abnormal thread

Use printf "% x \ n" abnormal thread thread number will be converted to hexadecimal number

Use jstack process ID | grep 16 hexadecimal numbers -A90 abnormal thread to locate the position of the error code (last -A90 is the number of log lines, can also be output to a text file or other digital). You can see the position of the error code.

Precautions:

If prompted -bash: jstack: command not found, you can find a directory of jdk, go to the bin directory,

        ./Jstack in the implementation process ID | grep 16 hexadecimal numbers -A90 abnormal thread can be.

   
If prompted well-known file is not secure, it is because the problem account permissions. In / tmp / hsperfdata_ $ USER / directory, there was a process ID file named, when we execute jmap or jstack appear on the Syrian information, check execution if a user command and user hsperfdata_ $ USER This file belongs to the same, If not, then switching execution to conform to. Execute: sudo -u privileged account ./jstack process ID | grep 16 hexadecimal numbers -A50 abnormal thread can be.

References: https://blog.csdn.net/chenjunan888/article/details/80447800

Guess you like

Origin www.cnblogs.com/1234cjq/p/11264212.html