Here are the detailed steps:
1. First determine the ID of the process, you can use the jps-v or the top command to view directly
2. To see which thread in the process is consuming a large number of CPUs, execute Top-h-p [PID] results as follows:
You can find a total of 9 threads numbered 350xx occupy 100% of the CPU, OK, next we take a random thread ID, suppose we want to see the number 35053 this thread.
First turn 35053 into 16 binary is 88ED (can be converted with open source China online tool)
3. Next we output all threads in the process to a file, executing: jstack [PID] > Jstack.txt
4. Find the corresponding thread ID in the process, execute: Cat Jstack.txt | Grep-i 88ED
The result is:
"HTTP Request from:/xxxx/blog/323432 (120.27.143.239)" #266 daemon prio=5 os_prio=0 tid=0x00007fcda4146800 nid=0x88e Run nable [0x00007fcd54178000]
As a result, when the/xxxx/blog/323432 link is requested, the server's processing thread consumes 100% of the CPU.
Analyzing which thread in the Java process consumes a lot of CPU processing time