1.查詢cpu消耗最大的行程
jps 先找出那些java程式
top 指令查看那些java行程消耗的cpu比較大
2.找出佔用記憶體最大的執行緒
1.指令:ps p pid -L -o pcpu,pid, tid,time,tname,cmd
%CPU PID TID TIME TTY CMD 0.0 32060 32060 00:00:00 ? /data/java 0.0 32060 32061 00:00:00 ? /data/java
列印線程的10進位格式為16進位格式(TID對應的那一列):
printf "%x\n" 32061 7d3d
3.查詢jstack中對應的線程資訊
[root@10-10-244-163 ~]# jstack 32060|grep 7d3d -C 10 at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216) "Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f6dc0108000 nid=0x7d41 in Object.wait() [0x00007f6da99cb000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference.tryHandlePending(Reference.java:191) - locked <0x00000000c08d0ab8> (a java.lang.ref.Reference$Lock) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153) "main" #1 prio=5 os_prio=0 tid=0x00007f6dc000d000 nid=0x7d3d runnable [0x00007f6dc9e1a000] java.lang.Thread.State: RUNNABLE at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409) at java.net.ServerSocket.implAccept(ServerSocket.java:545) at java.net.ServerSocket.accept(ServerSocket.java:513) at org.apache.catalina.core.StandardServer.await(StandardServer.java:453) at org.apache.catalina.startup.Catalina.await(Catalina.java:777) at org.apache.catalina.startup.Catalina.start(Catalina.java:723) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
以上是jvm記憶體洩漏排查流程的詳細內容。更多資訊請關注PHP中文網其他相關文章!