当前位置:网站首页>Record the troubleshooting process of excessive CPU usage

Record the troubleshooting process of excessive CPU usage

2022-06-21 13:57:00 The forest wind is at ease

Today, the test feedback online test environment has almost no data in the warehouse , Recently, it happened that the new version was tested , It is estimated that what has affected , Start with the deployment environment troubleshooting .

top Command to view the operation of the server , It is found that a process has been occupying CPU,CPU Consumption basic 100%.

 Insert picture description here
pwdx Check the process , It is found that the process is just the application of the module .

 Insert picture description here
View the thread list of this process , Let's see what thread is taking up CPU Too high :ps -mp 5866 -o THREAD,tid,time.

 Insert picture description here
You can see that there is a thread CPU The occupation is absurdly high , Logging thread id, The thread id Turn into 16 Base number ,jstack Print the stack of the process , Find the corresponding thread .

 Insert picture description here
From the output, you can see the specific blocked threads , Go to the specific code , It is found that the processing of getting elements from a blocking queue is unreasonable , There's a dead cycle , Lead to CPU Idle .
 Insert picture description here
Summarize the specific troubleshooting process :

#  View process number pid
top 

#  Confirm the module application corresponding to the process number 
pwdx pid 

#  Find the most time-consuming thread tid
ps -mp pid -o THREAD,tid,time 

#  Turn into 16 Base number 
printf "%x\n" tid

#  The stack finds the specified thread , View the specific running status of the thread 
jstack pid | grep tid -A 30
原网站

版权声明
本文为[The forest wind is at ease]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202221430525359.html