The online background alarm CPU
is occupied 100%
, CPU
and the usage is too high. This article introduces how to troubleshoot CPU
the cause of the high usage.
Step 1. top
Enter top
the command to find CPU
the process with the highest occupancy. Shift+P
Sort by key
It can be seen CPU
that the highest occupancy pid
is 92129
.
Step 2. top -Hp pid
View the thread information in the specified process, which pid
is the first step pid
.
top -Hp 92129
pid
Find the thread with the highest occupancy 92156
, and then convert it to 十六进制
, using the formula to convert:
printf '%x' 92156
The output is:167fc
Step 3. jstack command
Use jstack
the command to analyze the process status. In order to facilitate the query, the analysis results are input into a file, jstack pid > x.txt
where pid
is 步骤1
the process number.
jstack 92129 > x.txt
Open the file and query the converted hexadecimal number x.txt
in the file :步骤2
Find the non- Jdk
code, which is also the code you wrote, and you can find the root of the problem.
Summarize
top
find the process numbertop -Hp
Process number, find the thread number, and convert the thread into hexadecimal.jstack pid
analyze. According to the hexadecimal query, find the location of the problem code.