Arthas运用且与Docker结合

dockerfile 配置

COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas

执行流程

##基础镜像

1.java -jar /opt/arthas/arthas-boot.jar

## help
help
## 查看dashboard
dashboard 回车

## 查看线程1
thread 1

## 反编译class
jad demo.MathGame

## 可以通过 sc 命令来查找JVM里已加载的类
sc -d *MathGame


## 查看函数返回
watch -h
watch demo.MathGame primeFactors params
watch demo.MathGame primeFactors returnObj
watch demo.MathGame primeFactors '{params, target, returnObj}' -x 2
watch *StringUtils isBlank params '#cost>100'

arthas 重点命令

thread

排查应用请求响应慢,锁等待,异常线程定位

thread -help
thread -n -1 The number of thread(s) to show, ordered by cpu utilization, -1 to show all
thread id  查看指定线程堆栈
thread -b  Find the thread who is holding a lock that blocks the most number of threads.
thread -i Specify the sampling interval (in ms) when calculating cpu usage.
trace

1.确定耗时节点 、2.通过方法执行实际调用路径

trace demo.MathGame primeFactors
stack

查看方法的调用链

stack demo.MathGame primeFactors -n 5 '1==1'
tt

查看方法的调用记录 并对异常记录进行查看

tt -t demo.MathGame primeFactors
tt -i index    指定查看  index为第一步报错的序列
jad

1.指定代码改动是否提交 2.查看代码源码

watch

1.查看方法入参和出参

idea 插件

1.使用手册 https://www.yuque.com/arthas-idea-plugin/help

停止arthas

java -jar /opt/arthas/arthas-client.jar 127.0.0.1 3658 -c “stop”

参考地址

https://arthas.aliyun.com/doc/docker.html
https://blog.csdn.net/zhang_jiayuan/article/details/109261904

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值