JVM Series -CPU usage rate troubleshooting methods

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/projim_tao/article/details/102680626

introduction

Java programs often have problems with high CPU usage in the actual production process, the reason how to troubleshoot it, we probably describe troubleshooting methods.

First, the CPU-intensive investigation process

Use topthe command, press the P button or press shift + P keys will be carried out in the capital opened in the capital did not open the case in accordance with the level of CPU usage sort, search process to obtain maximum utilization of process PID.

Second, find the actual occupation of the highest CPU thread

Use the command top -H -p PID, where PID is the last step acquisition process PID, by this command to view the highest thread CPU ID actually occupied, where several TID

Third, access to thread stack information corresponding thread

  • Use the command printf "%x\n" tidto convert hex thread ID
  • Use the command jstack pid |grep tid -A 50, here tid 16 hexadecimal conversion after the previous step, use this command to view information corresponding to a thread stack of the thread, to be analyzed from the corresponding code based on the thread stack.

Guess you like

Origin blog.csdn.net/projim_tao/article/details/102680626