Skip to content

Commit aec2ad2

Browse files
committed
monitor
1 parent e95b2b7 commit aec2ad2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

markdown-file/monitor.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,12 @@ access_log /home/wwwlogs/hicrew.log special_main;
858858
#### 一次 JVM 引起的 CPU 高排查
859859

860860
- 使用 `ps -ef | grep java`,查看进程 PID
861-
- 根据高 CPU 的进程 PID,查看其线程 CPU 使用情况:`top -Hp PID`,找到占用 CPU 资源高的线程 PID
862-
- 保存堆栈情况:`jstack -l PID >> /opt/jstack-tomcat1-PID-20181017.log`
863-
- 把占用 CPU 资源高的线程十进制的 PID 转换成 16 进制:`printf "%x\n" PID`,比如:`printf "%x\n" 12401` 得到结果是:`3071`
861+
- 根据高 CPU 的进程 PID,查看其线程 CPU 使用情况:`top -Hp PID`,找到占用 CPU 资源高的线程 TID
862+
- 也可以用:`ps -mp PID -o THREAD,tid,time`
863+
- 保存堆栈情况:`jstack -l TID >> /opt/jstack-tomcat1-TID-20181017.log`
864+
- 把占用 CPU 资源高的线程十进制的 TID 转换成 16 进制:`printf "%x\n" TID`,比如:`printf "%x\n" 12401` 得到结果是:`3071`
864865
- 在刚刚输出的那个 log 文件中搜索:`3071`,可以找到:`nid=0x3071`
865-
- 也可以在终端中直接看:`jstack PID |grep 十六进制线程 -A 30`,此时如果发现如下:
866+
- 也可以在终端中直接看:`jstack TID |grep 十六进制线程 -A 30`,此时如果发现如下:
866867

867868
```
868869
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007fd0ac01f000 nid=0x66f runnable

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy