当前位置: 首页 > news >正文

阿里云Arthas使用——通过watch命令查看类的返回值 捞数据出来

在这里插入图片描述

前言

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

[root@iZuf61wy7p4tbr7lmwv18iZ software]# ./as.sh 
Error: telnet is not installed. Try to use java -jar arthas-boot.jar
 yum install -y telnet-server.x86_64yum install -y telnet.x86_64

在这里插入图片描述

在这里插入图片描述

报错:unzip is not installed

[root@iZuf61wy7p4tbr7lmwv18iZ software]# ./as.sh 
Error: unzip is not installed. Try to use java -jar arthas-boot.jar
yum -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

在这里插入图片描述

[arthas@5418]$ watch com.wattsonic.iot.gateway.modbus.command.GroupCommand parseResult 'returnObj' -x3
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 120 ms, listenerId: 5
method=com.wattsonic.iot.gateway.modbus.command.GroupCommand.parseResult location=AtExit
ts=2023-11-29 17:27:41; [cost=0.336862ms] result=@HashMap[@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命令查看调用方法的输出参数;

http://www.lryc.cn/news/254550.html

相关文章:

  • Redis中持久化策略RDB与AOF优缺点对比
  • 通用plantuml 时序图(Sequence Diagram)模板头
  • Domino多Web站点托管
  • 防火墙补充NAT
  • 配置和管理VLAN
  • dtaidistance笔记:dtw_ndim (高维时间序列之间的DTW)
  • 2 文本分类入门:TextCNN
  • 算法初阶双指针+C语言期末考试之编程题加强训练
  • 【Spark基础】-- 宽窄依赖
  • Spatial Data Analysis(六):空间优化问题
  • PHP短信接口防刷防轰炸多重解决方案三(可正式使用)
  • C#大型LIS检验信息系统项目源码
  • 【C语言】数据在内存中的存储
  • Java聊天程序(一对一)简单版
  • Linux下超轻量级Rust开发环境搭建:一、安装Rust
  • 定义一个学生类,其中有3个私有数据成员学号、姓名、成绩,以及若于成员。 函数实现对学生数据的赋值和输出。
  • 1.2 C语言简介
  • 小白学Java之数组问题——第三关黄金挑战
  • 各大期刊网址
  • 使用autodl服务器,在A40显卡上运行, Yi-34B-Chat-int4模型,并使用vllm优化加速,显存占用42G,速度18 words/s
  • unity 2d 入门 飞翔小鸟 下坠功能且碰到地面要停止 刚体 胶囊碰撞器 (四)
  • 速达软件任意文件上传漏洞复现
  • Name or service not knownstname
  • [Geek Challenge 2023] web题解
  • 【recrutment / Hiring / Job / Application】
  • 二极管:ESD静电保护二极管
  • 【根据数组元素生成随机颜色函数】
  • 鸿蒙一出,android开发处境再受重创
  • ruoyi+Hadoop+hbase实现大数据存储查询
  • Word 在页眉或页脚中设置背景颜色