码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-07-10 20:42:38      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:常见   net   err   技术   deploy   cte   lazy   diff   异常排查   

初次使用时的一些问题

[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 

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

标签:常见   net   err   技术   deploy   cte   lazy   diff   异常排查   

原文地址:https://www.cnblogs.com/shay/p/13280936.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!