海宏集团网站建设方案,深圳航空网上值机选座,线下推广活动策划方案,wordpress同步新浪博客前言
Arthas 是一款线上监控诊断产品#xff0c;通过全局视角实时查看应用 load、内存、gc、线程的状态信息#xff0c;并能在不修改应用代码的情况下#xff0c;对业务问题进行诊断#xff0c;包括查看方法调用的出入参、异常#xff0c;监测方法执行耗时#xff0c;类…
前言
Arthas 是一款线上监控诊断产品通过全局视角实时查看应用 load、内存、gc、线程的状态信息并能在不修改应用代码的情况下对业务问题进行诊断包括查看方法调用的出入参、异常监测方法执行耗时类加载信息等大大提升线上问题排查效率。
本篇博客介绍如何通过watch命令查看调用方法的输出参数。
其他的Arthas博客文章如下
阿里云的Arthas的使用 安装和使用 死锁查找案例重新加载案例慢调用分析 目录 前言引出as.sh方式的安装报错telnet is not installed报错unzip is not installed报错no available java process to attach 通过Arthas进行捞数据分析出要watch的类watch命令 总结 引出 1.JVM调优的工具阿里云的Arthas的使用安装和使用 2.watch命令查看调用方法的输出参数
https://arthas.aliyun.com/doc/install-detail.html
as.sh方式的安装
报错telnet is not installed
[rootiZuf61wy7p4tbr7lmwv18iZ software]# ./as.sh
Error: telnet is not installed. Try to use java -jar arthas-boot.jaryum install -y telnet-server.x86_64yum install -y telnet.x86_64报错unzip is not installed
[rootiZuf61wy7p4tbr7lmwv18iZ software]# ./as.sh
Error: unzip is not installed. Try to use java -jar arthas-boot.jaryum -y install telnet.x86_64 unzip zip报错no available java process to attach
Error: no available java process to attach通过Arthas进行捞数据
分析出要watch的类 一步一步分析要watch的类 找到是哪个类的哪个方法 watch命令
https://arthas.aliyun.com/doc/commands.html
让你能方便的观察到指定函数的调用情况。能观察到的范围为返回值、抛出异常、入参通过编写 OGNL 表达式进行对应变量的查看。
观察表达式默认值是{params, target, returnObj} 通过as.sh启动arthas 启动arthas成功 watch com.wattsonic.iot.gateway.modbus.command.GroupCommand parseResult returnObj -x3[arthas5418]$ watch com.wattsonic.iot.gateway.modbus.command.GroupCommand parseResult returnObj -x3
Press Q or CtrlC to abort.
Affect(class count: 1 , method count: 1) cost in 120 ms, listenerId: 5
methodcom.wattsonic.iot.gateway.modbus.command.GroupCommand.parseResult locationAtExit
ts2023-11-29 17:27:41; [cost0.336862ms] resultHashMap[String[L2加热器目标水温]:Long[0],String[L3加热器目标水温]:Long[0],String[L1加热器24h用电量]:Long[0],String[L2加热器24h用电量]:Long[0],String[加热器状态STATE1]:Long[1500],String[最大总功率]:Long[0],String[L2加热器负载功率]:Long[0],String[L3加热器负载功率]:Long[0],String[加热器状态STATE2]:Long[0],String[L3加热器24h用电量]:Long[0],String[L2加热器当前温度]:Long[1500],String[L1加热器负载功率]:Long[0],String[L1加热器目标水温]:Long[0],String[L1加热器当前温度]:Long[0],String[L3加热器当前温度]:Long[1500],
]总结
1.JVM调优的工具阿里云的Arthas的使用安装和使用 2.watch命令查看调用方法的输出参数;