您的位置:首页 > 其它

阿里巴巴 arthas教程1

2019-09-03 18:39 84 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/weixin_39800144/article/details/100524672

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线程

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: