arthas 查看哪个方法调用最耗时_arthas(阿尔萨斯)使用实践—-查看慢方法 /方法耗时等...

arthas(阿尔萨斯)使用实践—-查看慢方法 /方法耗时等

初次使用时的一些问题

[ERROR] Target process 116477 is not the process using port 3658, you will connect to an unexpected process.

[ERROR] 1. Try to restart arthas-boot, select process 90686, shutdown it first with running the ‘stop’ command.

[ERROR] 2. Or try to use different telnet port, for example: java -jar arthas-boot.jar –telnet-port 9998 –http-port -1

这个问题初用者必出,原因为arthas选择一个应用进行诊断时弄了一个session,可以使用arthas-client,web arthas client进行登录,这个提示告诉你要先关闭以前的arthas-boot,或者重新选择一个端口

你可以这么做,在~/.arthas/lib/3.1.7/arthas下有一个arthas-client.jar使用java -jararthas-client.jar可以进入上次的session,shutdown后就可以选择其它的进程进行诊断了,或者你可以继续诊断当前应用

退出art has:shutdown

github项目地址:https://github.com/alibaba/arthas

进入要监控的那个服务所在的机器上,切换到deploy 用户

下载并运行:

wget https://alibaba.github.io/arthas/arthas-boot.jar

java -jar arthas-boot.jar

查看慢方法

命令:trace 类路径 类方法名

示例: trace  com.xxx.helper.impl.xxxxImpl useExchangeVoucher

查看方法耗时

命令 :tt -t 类路径 类方法名

示例:tt -t com.xxxx.helper.impl.xxxxImpl useExchangeVoucher

查看线程状态

命令: thread

查看所有线程状态

命名: thread [threadId]

thread -b查看阻塞的线程

thread -n[number]查看占用cpu最高的前number个线程

arthas常见的操作实例

1.替代dev环境下用LogUtils.COMMON.debug进行调试。

查看接口入参和返回值

命令:watch com.xxxiface.xxxIface couponList “{params,returnObj}” -x 2

2.Exception 异常排查。

tt -t {interface} {method}

tt -i {id} -w ‘throwExp’

【此图来源于网络】

也可以通过 watch {interface} {method} “throwExp” -x 2    查看异常

更多【https://github.com/alibaba/arthas/issues?utf8=%E2%9C%93&q=label%3Auser-case+】

https://juejin.im/post/5b6b986c6fb9a04fd1603f4a#heading-30

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值