阿里巴巴 arthas教程1

1.安装arthas

这里在local目录创建myarthas目录,然后安装arthas,直接拉取即可。

[root@localhost local]# cd myarthas/
[root@localhost myarthas]# wget https://alibaba.github.io/arthas/arthas-boot.jar
--2019-07-12 13:54:53--  https://alibaba.github.io/arthas/arthas-boot.jar
Resolving alibaba.github.io (alibaba.github.io)... 185.199.110.153, 185.199.111.153, 185.199.108.153, ...
Connecting to alibaba.github.io (alibaba.github.io)|185.199.110.153|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98637 (96K) [application/java-archive]
Saving to: ‘arthas-boot.jar’

100%[================================================================================================================================================>] 98,637      8.75KB/s   in 11s    

2019-07-12 13:55:09 (8.75 KB/s) - ‘arthas-boot.jar’ saved [98637/98637]

[root@localhost myarthas]# 

如果wget命令无法使用,请参考:-bash: wget: command not found 解决方法

2.启动

启动命令很简单,因为arthas是一个jar格式,直接启动即可。

[root@jrjk-pre myarthas]# java -jar arthas-boot.jar 
[INFO] arthas-boot version: 3.1.1
[INFO] Found existing java process, please choose one and hit RETURN.
* [1]: 23431 fsp-eureka-1.0-RELEASE.jar
  [2]: 28935 fsp-config-1.0-SNAPSHOT.jar
  [3]: 29896 loan-web-1.0-RELEASE.jar
  [4]: 29006 demo-web-1.0-RELEASE.jar
  [5]: 31024 finance-web-1.0-RELEASE.jar
  [6]: 29301 credit-web-1.0-RELEASE.jar
  [7]: 23126 xxl-job-admin-2.0.1.jar
  [8]: 29079 fsp-gate-1.0-RELEASE.jar
  [9]: 10201 basics-web-1.0-RELEASE.jar
  [10]: 29596 user-web-1.0-RELEASE.jar
  [11]: 23326 fsp-tx-4.1.0.jar
  [12]: 29790 content-web-1.0-RELEASE.jar

3.attach到相关进程

2中命令会展示所有的java进程,我们输入对应的编号,enter即可attach到相关进程。比如,我们输入6,就会attach到pid为29301的credit-web进程上。

6
[INFO] arthas home: /root/.arthas/lib/3.1.1/arthas
[INFO] Try to attach process 29301
[INFO] Attach process 29301 success.
[INFO] arthas-client connect 127.0.0.1 3658
  ,---.  ,------. ,--------.,--.  ,--.  ,---.   ,---.                           
 /  O  \ |  .--. ''--.  .--'|  '--'  | /  O  \ '   .-'                          
|  .-.  ||  '--'.'   |  |   |  .--.  ||  .-.  |`.  `-.                          
|  | |  ||  |\  \    |  |   |  |  |  ||  | |  |.-'    |                         
`--' `--'`--' '--'   `--'   `--'  `--'`--' `--'`-----'                          
                                                                                

wiki      https://alibaba.github.io/arthas                                      
tutorials https://alibaba.github.io/arthas/arthas-tutorials                     
version   3.1.1                                                                 
pid       29301                                                                 
time      2019-09-03 18:20:24                                                   

4.dashboard

dashboard命令会展示当前进程信息,ctrl+c退出。

在这里插入图片描述
具体分区如下:
在这里插入图片描述
参数说明:

ID: Java级别的线程ID,注意这个ID不能跟jstack中的nativeID一一对应
NAME: 线程名
GROUP: 线程组名
PRIORITY: 线程优先级, 1~10之间的数字,越大表示优先级越高
STATE: 线程的状态
CPU%: 线程消耗的cpu占比,采样100ms,将所有线程在这100ms内的cpu使用量求和,再算出每个线程的cpu使用占比。
TIME: 线程运行总时间,数据格式为分:秒
INTERRUPTED: 线程当前的中断位状态
DAEMON: 是否是daemon线程

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值