How to troubleshoot if the online CPU of Java project is too high

1. Check the process

# 查看cpu过高的进程
top -c

Insert image description here

2. Use the pid to find the thread with too high CPU

# 查找
ps H -eo pid,tid,%cpu | grep 19235

You can see that 19236 is too high
Insert image description here

3. Thread conversion to hexadecimal

printf "%x\n" 19236

Insert image description here

4. View the code address

# 19235 进程
# 4b24 线程16进制
# -A20  前20行
jstack 19235 | grep 4b24 -A20

Insert image description here

5. View the code

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_49390750/article/details/132875421