性能调优命令之jstack

jstack是Java虚拟机的线程堆栈跟踪工具,用于排查CPU高使用率等问题。通过结合top、PS、jstack等Linux命令,可以分析线程状态,识别死锁和性能瓶颈。在遇到网络拥塞导致的无限循环问题时,jstack能帮助定位问题代码,辅助优化。
摘要由CSDN通过智能技术生成

jstack是java虚拟机自带的一种线程堆栈跟踪工具。

/opt/java8/bin/jstack

Usage:
    jstack [-l] <pid>
        (to connect to running process)   #连接活动线程
    jstack -F [-m] [-l] <pid>
        (to connect to a hung process)    #连接阻塞线程
    jstack [-m] [-l] <executable> <core>
        (to connect to a core file)       #连接dump的文件
    jstack [-m] [-l] [server_id@]<remote server IP or hostname>
        (to connect to a remote debug server)     #连接远程服务器

Options:
    -F  to force a thread dump. Use when jstack <pid> does not respond (process is hung)
    -m  to print both java and native frames (mixed mode)
    -l  long listing. Prints additional information about locks
    -h or -help to print this help message
$ jstack 5611
2021-06-06 22:05:43
Full thread dump Java HotSpot(TM) Client VM (25.271-b09 mixed mode):

"RemoteInvocationHandler [#2]" #63304 daemon prio=5 os_prio=0 tid=0xe3f4bc00 nid=0x240 in Object.wait() [0xe3b3e000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
	- locked <0xea7480c8> (a java.lang.ref.ReferenceQueue$Lock)
	at hudson.remoting.RemoteInvocationHandler$Unexporter.run(RemoteInvocationHandler.java:603)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:118)
	at java.lang.Thread.run(Thread.java:748)

"Attach Listener" #63199 daemon prio=9 os_prio=0 tid=0xe2a52800 nid=0x7938 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Ping thread
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值