java application high cpu usage

An application takes up a lot of CPU, except that it is indeed a computationally intensive application, usually the reason is an infinite loop

 

Troubleshoot as follows:

1. According to the top command, it is found that the Java process whose PID is 28555 occupies up to 200% of the CPU and is faulty

2. Through the ps aux|grep <pid> command, it can be further determined that there is a problem with the tomcat process.
3. Display the thread list: ps -mp <pid> -o THREAD,tid,time

  Found the most time-consuming thread 28802, which takes up almost two hours of CPU time!

4. Convert the required thread ID to hexadecimal format: printf "%x\n" tid

5. Finally print the stack information of the thread: jstack pid |grep tid -A 30

Found the problematic code!
Now let's analyze the specific code: ShortSocketIO.readBytes(ShortSocketIO.java:106)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324779732&siteId=291194637