zoukankan      html  css  js  c++  java
  • 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 

  • 相关阅读:
    配置管理-SVN使用指南-Linux
    配置管理-SVN权限详解
    配置管理-SVN使用指南
    Unity3d之Mecanim(新版动画系统)
    Unity3d之Animation(动画系统)
    iTween基础之iTweenPath(自定义路径移动)
    iTween基础之Color(变换颜色)
    unity工具IGamesTools之批量生成帧动画
    unity2d之2d帧动画创建
    iTween基础之Fade(淡入淡出)
  • 原文地址:https://www.cnblogs.com/shay/p/13280936.html
Copyright © 2011-2022 走看看