windows安装 arthas

下载arthas-boot

https://arthas.aliyun.com/arthas-boot.jar

idea安装插件 arthas

file->setting->plugins->marketplace 搜索 arthas

安装下载

选择要监控类方法名,右键 arthas command

选择要监控的内容,这里查看耗时,选择trace,会将命令复制到剪切板。

启动监控

启动

1
java -jar D:\Java\arthas\arthas-boot.jar

选择idea启动的应用程序名称

1
2
3
4
5
6
7
[INFO] JAVA_HOME: D:\Java\jre
[INFO] arthas-boot version: 3.7.1
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 12160 org.jetbrains.plugins.scala.nailgun.NailgunRunner
[2]: 23328 com.artemis.flink.admin.FlinkApplication
[3]: 24336 org.jetbrains.jps.cmdline.Launcher
[4]: 25008 org.jetbrains.idea.maven.server.RemoteMavenServer36

输入 2 ,选择要监控的java进程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[INFO] arthas home: C:\Users\artemis\.arthas\lib\3.7.1\arthas
[INFO] Try to attach process 23328
[INFO] Found java home from System Env JAVA_HOME: D:\Java\jdk1.8.0_202
[INFO] Attach process 23328 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.7.1
main_class
pid 23328
time 2023-12-04 14:15:12
[arthas@23328]$

将复制的命令粘贴上

1
trace com.artemis.flink.admin.moudle.tableasset.service.TableCycleProcessor process  -n 5 --skipJDKMethod false 
1
2
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 218 ms, listenerId: 1

就可以啦