Mac 安装使用Arthas

2022-12-01  本文已影响0人  小螺丝钉cici

工具:https://arthas.aliyun.com/

image.png

1.安装arthas

curl -O https://alibaba.github.io/arthas/arthas-boot.jar

image.png

2.启动jar

java -jar arthas-boot.jar

image.png

3.出现所有可监控的进程,输入要监控的进程,回车

image.png
[INFO] Start download arthas from remote server: https://arthas.aliyun.com/download/3.6.7?mirror=aliyun
[INFO] File size: 12.92 MB, downloaded size: 9.60 MB, downloading ...
[INFO] Download arthas success.
[INFO] arthas home: /Users/cici/.arthas/lib/3.6.7/arthas
[INFO] Try to attach process 13160
Exception in thread "main" java.lang.IllegalArgumentException: Can not find tools.jar under java home: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home, please try to start arthas-boot with full path java. Such as /opt/jdk/bin/java -jar arthas-boot.jar
    at com.taobao.arthas.boot.ProcessUtils.findJavaHome(ProcessUtils.java:222)
    at com.taobao.arthas.boot.ProcessUtils.startArthasCore(ProcessUtils.java:233)
    at com.taobao.arthas.boot.Bootstrap.main(Bootstrap.java:586)

解决办法:

执行:vim ~/.bash_profile

添加以下内容:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

执行:source ~/.bash_profile

4. 启动接口观察

trace com.xx.assetsinnovation.scene.service.impl.xxxServiceImpl queryById -n 50 --skipJDKMethod false '#cost > 200'

image.png

trace com.xx.assetsinnovation.scene.service.impl.xxxServiceImpl queryById -n 5 --skipJDKMethod false '#cost > 200'

5.查看监控的结果

6. 接口性能达标,但是每次并发就是上不去

java -jar arthas-boot.jar --telnet-port 9998 --http-port 9999

7.监控客户端 http://127.0.0.1:8563/

除了在命令行查看外,还可以通过浏览器访问http://127.0.0.1:8563/查看。如下图:可以直接操作相关的命令参数

image.png image.png

8.退出

看见那个$符号,就是打开进入了监控客户端。可以使用quit(退出当前客户端)、stop\shutdown(关闭arthas服务端,并退出所有客户端)


image.png

9.常用命令

https://blog.csdn.net/huo065000/article/details/123231411

10.快速获取arthas命令

arthas的命令较多,如果每次都需要自己
idea安装插件 arthas idea

image
上一篇 下一篇

猜你喜欢

热点阅读