Arthas分析接口响应时间节点

一、介绍

Arthas 是Alibaba开源的Java诊断工具。可以在windows和Linux系统使用,本文介绍的是Arthas监控接口方法响应时长节点分析

一、安装和使用

一般生产环境是不允许随意访问外网下载内容的,所以本次安装为离线安装,版本为3.6.7

下载地址:arthas-packaging-3.6.7-bin

上传到服务器自定义目录后解压

在解压目录上执行:

[root@mvxl73843 arthas]# ./install-local.sh
install to local succeeded.

安装成功后即可启动(ps:jar包启动肯定要java环境,这个就不在这里介绍jdk的安装了):

启动命令: java -jar arthas-boot.jar

启动的时候需要选择监控的java应用,如下输入1

[apps@mvxl73845 arthas]$ java -jar arthas-boot.jar
[INFO] JAVA_HOME: /apps/svr/jdk1.8/jre
[INFO] arthas-boot version: 3.6.7
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 63765 ./cloud-purchase-sale-stock.jar
1
[INFO] arthas home: /apps/arthas
[INFO] Try to attach process 63765
Picked up JAVA_TOOL_OPTIONS: 
[INFO] Attach process 63765 success.
[INFO] arthas-client connect 127.0.0.1 3658
  ,---.  ,------. ,--------.,--.  ,--.  ,---.   ,---.                           
 /  O  \ |  .--. ''--.  .--'|  '--'  | /  O  \ '   .-'                          
|  .-.  ||  '--'.'   |  |   |  .--.  ||  .-.  |`.  `-.                          
|  | |  ||  |\  \    |  |   |  |  |  ||  | |  |.-'    |                         
`--' `--'`--' '--'   `--'   `--'  `--'`--' `--'`-----'                          

wiki       https://arthas.aliyun.com/doc                                        
tutorials  https://arthas.aliyun.com/doc/arthas-tutorials.html                  
version    3.6.7                                                                
main_class                                                                      
pid        63765                                                                
time       2023-03-31 10:52:07 

分析响应时间命令:trace+类路径+方法名

如:trace+com.xx.xxController test
test为方法名

[arthas@47853]$ trace com/xx/quality/component/oem/report/controller/QcOemTestReportController reportPageQury
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 480 ms, listenerId: 1
`---ts=2023-03-31 10:32:20;thread_name=http-nio-30000-exec-26;id=3b2d;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@3b545206
    `---[1611.585862ms] com.xx.quality.component.oem.report.controller.QcOemTestReportController:reportPageQury()
        `---[99.95% 1610.699935ms ] com.xx.quality.component.oem.report.service.IQcOemTestReportService:reportPageQury() #239

上面由于贴代码缘故,没有展示样式,实际时间占用过长节点会字体标红,很容易看到。

至此,基本介绍已完结,更多用法可以看官方文档:下载 | arthasarthas 使用文档https://arthas.aliyun.com/doc/download.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值