1,部署
下载地址:https://arthas.aliyun.com/download/latest_version?mirror=aliyun
arthas依赖jdk,运行前必须安装jdk环境
arthas监控的是java进程,所以运行前必须要有java进程
解压arthas-packaging-3.6.6-bin.zip文件,
1,windows环境部署
java -jar arthas-boot.jar
2,linux环境部署
将zip包传到/usr/local目录下解压,unzip命令没有需要用yum安装(yum install -y unzip zip)
cd /usr/local
mkdir arthas
unzip -d ./arthas arthas-packaging-3.6.6-bin.zip
cd arthas
java -jar arthas-boot.jar
2,相关命令
watch命令,idea需要安装arthas插件,获取监控的命令
watch com.xxl.job.admin.controller.UserController add '{params,returnObj,throwExp}' -n 5 -x 3
请求执行后arthas控制台打印结果
dashboard命令可以查看cpu使用率和内存消耗
thread命令查看当前线程信息
参数名称 | 参数说明 |
---|---|
id | 线程id |
-n 前N个 | 指定最忙的前N个线程并打印堆栈 |
b | 找出当前阻塞其他线程的线程 |
i 200 | 指定cpu使用率统计的采样间隔,单位为毫秒,默认值为200 |
–all | 显示所有匹配的线程 |
0 |
| --all | 显示所有匹配的线程 |
命令列表查看文档:https://arthas.aliyun.com/doc/commands.html