Skip to content

Commit 2d416ea

Browse files
authoredSep 21, 2018
Merge pull request #1 from alibaba/master
merge
2 parents 7fd1768 + b2e0bda commit 2d416ea

22 files changed

+1124
-48
lines changed
 
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report (EN)
3+
about: If you would like to report a issue to Arthas, please use this template.
4+
5+
---
6+
7+
- [ ] I have searched the [issues](https://github.com/alibaba/arthas/issues) of this repository and believe that this is not a duplicate.
8+
9+
### Environment
10+
11+
* Arthas version: xxx
12+
* Operating System version: xxx
13+
* Java version of target JVM: xxx
14+
* Java version of JVM used to attach: xxx
15+
16+
### Steps to reproduce this issue
17+
18+
1. xxx
19+
2. xxx
20+
3. xxx
21+
22+
### Expected Result
23+
24+
What do you expected from the above steps?
25+
26+
### Actual Result
27+
28+
What actually happens?
29+
30+
If there is an exception, please attach the exception trace:
31+
32+
```
33+
Just put your stack trace here!
34+
```

‎CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
## 开发者相关
1717

18-
编绎要求jdk7以上。因为使用到了jdk7才有的`java.lang.management.BufferPoolMXBea`,运行时要求是jdk6。
18+
编绎要求jdk7以上。因为使用到了jdk7才有的`java.lang.management.BufferPoolMXBean`,运行时要求是jdk6。
1919

2020
### 安装到本地
2121

‎LICENSE

+5
Original file line numberDiff line numberDiff line change
@@ -672,3 +672,8 @@ may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674674
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
675+
676+
677+
This product contains a modified version of greys-anatomy, which is
678+
available under a GNU General Public License 3 (GPLv3) license. For details,
679+
see https://github.com/oldmanpushcart/greys-anatomy.

‎NOTICE

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Arthas
2+
Copyright 2018 Alibaba Group
3+
4+
This product includes software developed at
5+
Alibaba Group (https://www.alibabagroup.com/en/global/home).
6+
7+
This product contains code form the greys-anatomy Project:
8+
9+
The greys-anatomy Project
10+
=================
11+
Please visit Github for more information:
12+
* https://github.com/oldmanpushcart/greys-anatomy

‎README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ Start Arthas:
5959

6060
English version is on the way, if you would like to contribute, please leave a message [here](https://github.com/alibaba/arthas/issues/51)
6161

62-
* [User manual](https://alibaba.github.io/arthas/)
63-
* [Installation](https://alibaba.github.io/arthas/install-detail.html)
64-
* [Quick start](https://alibaba.github.io/arthas/quick-start.html)
65-
* [Advanced usage](https://alibaba.github.io/arthas/advanced-use.html)
66-
* [Questions and answers](https://github.com/alibaba/arthas/labels/question-answered)
62+
* [User manual](https://alibaba.github.io/arthas/en)
63+
* [Installation](https://alibaba.github.io/arthas/en/install-detail.html)
64+
* [Quick start](https://alibaba.github.io/arthas/en/quick-start.html)
65+
* [Advanced usage](https://alibaba.github.io/arthas/en/advanced-use.html)
66+
* [Questions and answers](https://github.com/alibaba/arthas/issues?utf8=%E2%9C%93&q=label%3Aquestion-answered+)
6767
* [How to contribute](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)
6868

6969

@@ -300,3 +300,11 @@ $ classloader
300300
* https://alibaba.github.io/arthas/web-console
301301

302302
![web console](site/src/site/sphinx/_static/web-console-local.png)
303+
304+
305+
### Credit
306+
307+
* [greys-anatomy](https://github.com/oldmanpushcart/greys-anatomy): The Arthas code base has derived from Greys, we thank for the excellent work done by Greys.
308+
* [termd](https://github.com/termd/termd): Arthas's termnial implementation is based on termd, an open source library for writing terminal applications in Java.
309+
* [crash](https://github.com/crashub/crash): Arthas's text based user interface rendering is based on codes extracted from [here](https://github.com/crashub/crash/tree/1.3.2/shell)
310+
* [cli](https://github.com/eclipse-vertx/vert.x/tree/master/src/main/java/io/vertx/core/cli): Arthas's command line interface implementation is based on cli, open sourced by vert.x

‎README_CN.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ curl -L https://alibaba.github.io/arthas/install.sh | sh
5454
* [安装](https://alibaba.github.io/arthas/install-detail.html)
5555
* [快速入门](https://alibaba.github.io/arthas/quick-start.html)
5656
* [进阶使用](https://alibaba.github.io/arthas/advanced-use.html)
57-
* [Questions and answers](https://github.com/alibaba/arthas/labels/question-answered)
57+
* [Q&A](https://github.com/alibaba/arthas/issues?utf8=%E2%9C%93&q=label%3Aquestion-answered+)
5858
* [参与贡献](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)
5959

6060

@@ -295,3 +295,11 @@ $ classloader
295295

296296
![web console](site/src/site/sphinx/_static/web-console-local.png)
297297

298+
### Credit
299+
300+
301+
302+
* [greys-anatomy](https://github.com/oldmanpushcart/greys-anatomy): Arthas代码基于Greys二次开发而来,非常感谢Greys之前所有的工作,以及Greys原作者对Arthas提出的意见和建议!
303+
* [termd](https://github.com/termd/termd): Arthas的命令行实现基于termd开发,是一款优秀的命令行程序开发框架,感谢termd提供了优秀的框架。
304+
* [crash](https://github.com/crashub/crash): Arthas的文本渲染功能基于crash中的文本渲染功能开发,可以从[这里](https://github.com/crashub/crash/tree/1.3.2/shell)看到源码,感谢crash在这方面所做的优秀工作。
305+
* [cli](https://github.com/eclipse-vertx/vert.x/tree/master/src/main/java/io/vertx/core/cli): Arthas的命令行界面基于vert.x提供的cli库进行开发,感谢vert.x在这方面做的优秀工作。

‎site/src/site/sphinx/dashboard.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ uptime 16020s busy
5353
* STATE: 线程的状态
5454
* CPU%: 线程消耗的cpu占比,采样100ms,将所有线程在这100ms内的cpu使用量求和,再算出每个线程的cpu使用占比。
5555
* TIME: 线程运行总时间,数据格式为`分:秒`
56-
* INTERRUPTE: 线程当前的中断位状态
56+
* INTERRUPTED: 线程当前的中断位状态
5757
* DAEMON: 是否是daemon线程
5858

5959
### 截图展示
+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
classloader
2+
===========
3+
4+
Check the inheritance tree, urls and classes loading profiles of the class loaders.
5+
6+
It can be a great help for `ResourceNotFoundException` when you can use command `classloader`to specify a class loader to `getResources` and print all the urls of the valid resources.
7+
8+
### Options
9+
10+
|Name|Specification|
11+
|---:|:---|
12+
|[l]|count based on the class loader instance|
13+
|[t]|print all the inheritance structure of the class loaders|
14+
|[a]|list all the classes loaded by all the class loaders (use it with great caution since the output can be huge)|
15+
|`[c:]`|get the hashcode of the class loader|
16+
|`[c: r:]`|using class loader to search resource|
17+
18+
### Usage
19+
20+
* categorised by class loader
21+
22+
```s
23+
$ classloader
24+
name numberOfInstances loadedCountTotal
25+
com.taobao.pandora.service.loader.ModuleClassLoader 29 11659
26+
com.taobao.pandora.boot.loader.ReLaunchURLClassLoader 1 5308
27+
BootstrapClassLoader 1 3711
28+
com.taobao.arthas.agent.ArthasClassloader 2 2825
29+
sun.reflect.DelegatingClassLoader 332 332
30+
java.net.URLClassLoader 1 285
31+
sun.misc.Launcher$AppClassLoader 1 77
32+
sun.misc.Launcher$ExtClassLoader 1 46
33+
com.alibaba.fastjson.util.ASMClassLoader 2 3
34+
org.jvnet.hk2.internal.DelegatingClassLoader 2 2
35+
sun.reflect.misc.MethodUtil 1 1
36+
Affect(row-cnt:11) cost in 66 ms.
37+
```
38+
39+
* Categorized by class loader instance
40+
41+
```sh
42+
$ classloader -l
43+
name loadedCount hash parent
44+
BootstrapClassLoader 3711 null null
45+
com.alibaba.fastjson.util.ASMClassLoader@3bbaa1b8 2 3bbaa1b8 monitor's ModuleClassLoader
46+
com.alibaba.fastjson.util.ASMClassLoader@5e255d0b 1 5e255d0b eagleeye-core's ModuleClassLoader
47+
com.taobao.arthas.agent.ArthasClassloader@4fa2d7e6 1795 4fa2d7e6 sun.misc.Launcher$ExtClassLoader@a38d7a3
48+
com.taobao.arthas.agent.ArthasClassloader@522400c2 1033 522400c2 sun.misc.Launcher$ExtClassLoader@a38d7a3
49+
com.taobao.pandora.boot.loader.ReLaunchURLClassLoader@1817d444 5308 1817d444 sun.misc.Launcher$AppClassLoader@14dad5dc
50+
tbsession's ModuleClassLoader 285 609cd4d8 null
51+
pandora-qos-service's ModuleClassLoader 267 2f8dad04 null
52+
pandora-framework's ModuleClassLoader 78 4009e306 null
53+
filesync-client's ModuleClassLoader 4 4b8ee4de null
54+
rocketmq-client's ModuleClassLoader 431 247bddad null
55+
eagleeye-core's ModuleClassLoader 451 1ba9117e null
56+
alimonitor-jmonitor's ModuleClassLoader 134 22fcf7ab null
57+
metaq-client's ModuleClassLoader 35 41a2befb null
58+
hsf-mock's ModuleClassLoader 3 2002fc1d null
59+
monitor's ModuleClassLoader 1427 131ef10 null
60+
spas-sdk-service's ModuleClassLoader 7 10d307f1 null
61+
vipserver-client's ModuleClassLoader 137 7a419da4 null
62+
metrics's ModuleClassLoader 146 696da30b null
63+
mtop-uncenter's ModuleClassLoader 922 79d8407f null
64+
spas-sdk-client's ModuleClassLoader 235 4944252c null
65+
live-profiler-pandora's ModuleClassLoader 1 6913c1fb null
66+
notify-tr-client's ModuleClassLoader 472 fba92d3 null
67+
ons-sdk's ModuleClassLoader 70 23348b5d null
68+
tair-plugin's ModuleClassLoader 1053 7c9d8e2 null
69+
tddl-client's ModuleClassLoader 2354 4988d8b8 null
70+
config-client's ModuleClassLoader 93 429bffaa null
71+
diamond-client's ModuleClassLoader 360 3d5c822d null
72+
pandolet's ModuleClassLoader 99 41e1e210 null
73+
hsf's ModuleClassLoader 1796 3232a28a null
74+
acl.plugin's ModuleClassLoader 379 67080771 null
75+
buc.sso.client.plugin's ModuleClassLoader 195 13b6aecc null
76+
unitrouter's ModuleClassLoader 64 7e5afaa6 null
77+
switch's ModuleClassLoader 104 24313fcc null
78+
hsf-notify-client's ModuleClassLoader 57 4d0f2471 null
79+
java.net.URLClassLoader@7ec7ffd3 285 7ec7ffd3 sun.misc.Launcher$ExtClassLoader@a38d7a3
80+
javax.management.remote.rmi.NoCallStackClassLoader@53f65459 1 53f65459 null
81+
javax.management.remote.rmi.NoCallStackClassLoader@2833cc44 1 2833cc44 null
82+
org.jvnet.hk2.internal.DelegatingClassLoader@72cda8ee 1 72cda8ee monitor's ModuleClassLoader
83+
org.jvnet.hk2.internal.DelegatingClassLoader@1f57f96d 1 1f57f96d monitor's ModuleClassLoader
84+
sun.misc.Launcher$AppClassLoader@14dad5dc 77 14dad5dc sun.misc.Launcher$ExtClassLoader@a38d7a3
85+
sun.misc.Launcher$ExtClassLoader@a38d7a3 46 a38d7a3 null
86+
sun.reflect.misc.MethodUtil@1201f221 1 1201f221 sun.misc.Launcher$AppClassLoader@14dad5dc
87+
```
88+
89+
* Check inheritance tree of the class loaders
90+
91+
```shell
92+
$ classloader -t
93+
+-BootstrapClassLoader
94+
+-unitrouter's ModuleClassLoader
95+
+-diamond-client's ModuleClassLoader
96+
+-sun.misc.Launcher$ExtClassLoader@548a102f
97+
| +-sun.misc.Launcher$AppClassLoader@14dad5dc
98+
| +-com.taobao.arthas.agent.AgentLauncher$1@334e6bb8
99+
| | +-sun.reflect.DelegatingClassLoader@328b3a05
100+
| | +-sun.reflect.DelegatingClassLoader@73f44f24
101+
```
102+
103+
* Check the real urls of `URLClassLoader`
104+
105+
```shell
106+
$ classloader -c 5ffe9775
107+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/commons-lang-2.6.jar
108+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/log4j-1.2.16.jar
109+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/logger.api-0.1.4.jar
110+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.api-2.0.7-SNAPSHOT.jar
111+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.container-2.0.7-SNAPSHOT.jar
112+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.thirdcontainer-2.0.7-SNAPSHOT.jar
113+
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/picocontainer-2.14.3.jar
114+
```
115+
116+
* Using class loader to search for resource
117+
118+
```shell
119+
$ classloader -c 226b143b -r META-INF/MANIFEST.MF
120+
jar:file:/Users/hello/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar!/META-INF/MANIFEST.MF
121+
jar:file:/Users/hello/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar!/META-INF/MANIFEST.MF
122+
```
123+
124+
* Using class loader to look for `*.class` file
125+
126+
```shell
127+
$ classloader -c 1b6d3586 -r java/lang/String.class
128+
jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class
129+
```

‎site/src/site/sphinx/en/commands.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Commands List
2+
=============
3+
4+
* [dashboard](dashboard.md)
5+
* [thread](thread.md)
6+
* [jvm](jvm.md)
7+
* [sysprop](sysprop.md)
8+
* [getstatic](getstatic.md)
9+
10+
11+
12+
* [sc](sc.md)
13+
* [sm](sm.md)
14+
* [dump](dump.md)
15+
16+
* [jad](jad.md)
17+
* [classloader](classloader.md)
18+
* [redefine](redefine.md)
19+
20+
* [monitor](monitor.md)
21+
* [watch](watch.md)
22+
* [trace](trace.md)
23+
* [stack](stack.md)
24+
* [tt](tt.md)
25+
26+
* [options](options.md)
27+
28+
### Arthas Basic Commands
29+
30+
* help - check the assistant info for the command
31+
* cls - clear out the current screen area
32+
* session - check the current session profile
33+
* [reset](reset.md) - clear the injected code from the classes (B.T.W when Arthas server closed, all the injected will also be cleared)
34+
* version - the version of the working Arthas
35+
* quit - exit the current Arthas client without affecting other clients
36+
* shutdown - terminate the Arthas server and all clients
37+
* [keymap](keymap.md) - shortcuts for Arthas and also you can define your own

‎site/src/site/sphinx/en/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
copyright = u'2018, Alibaba Middleware Group, and contributors'
5353
author = u'Alibaba Middleware Group, and contributors'
5454

55-
github_doc_root = 'https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/en'
55+
github_doc_root = 'https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/en/'
5656

5757
# The version info for the project you're documenting, acts as replacement for
5858
# |version| and |release|, also used in various other places throughout the

‎site/src/site/sphinx/en/dashboard.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
dashboard
2+
=========
3+
4+
This is the realtime dashboard for the system; press `Ctrl+C` to exit.
5+
6+
When running in *Ali-tomcat*, the dashboard will present the realtime statistics of the tomcat including [QPS](https://en.wikipedia.org/wiki/Queries_per_second), RT, error counts, thread profile and the like.
7+
8+
### A Demo
9+
10+
```
11+
$ dashboard
12+
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON
13+
889 RMI TCP Connection(15)-30.10.166. RMI Runtime 9 RUNNABLE 48 0:5 false true
14+
1077 Timer-for-arthas-dashboard-0 system 9 RUNNABLE 24 0:0 false true
15+
1074 as-selector-daemon system 9 RUNNABLE 12 0:0 false true
16+
284 JMX server connection timeout 284 RMI Runtime 9 TIMED_WAITI 8 0:3 false true
17+
16 Timer-1 main 5 TIMED_WAITI 5 0:9 false true
18+
47 Pandora pandora-qos-reporter Pool main 5 TIMED_WAITI 0 0:0 false true
19+
48 JmonitorClient-CheckThread Pool [ main 5 TIMED_WAITI 0 0:0 false true
20+
49 JmonitorClient-HeartBeat Pool [Th main 5 TIMED_WAITI 0 0:0 false true
21+
50 JmonitorClient-ReaderThread Pool main 5 TIMED_WAITI 0 0:0 false true
22+
957 RMI TCP Connection(16)-30.10.166. RMI Runtime 9 RUNNABLE 0 0:2 false true
23+
51 JmonitorClient-WriterThread Pool main 5 TIMED_WAITI 0 0:0 false true
24+
52 ContainerBackgroundProcessor[Stan main 5 TIMED_WAITI 0 0:0 false true
25+
53 http-bio-8080-Acceptor-0 main 5 RUNNABLE 0 0:2 false true
26+
54 http-bio-8080-AsyncTimeout main 5 TIMED_WAITI 0 0:0 false true
27+
11 GC Daemon system 2 TIMED_WAITI 0 0:0 false true
28+
Memory used total max usage GC
29+
heap 59M 223M 1820M 3.26% gc.ps_scavenge.count 118
30+
ps_eden_space 14M 114M 668M 2.11% gc.ps_scavenge.time(ms) 1890
31+
ps_survivor_space 6M 6M 6M 96.08% gc.ps_marksweep.count 5
32+
ps_old_gen 39M 103M 1365M 2.86% gc.ps_marksweep.time(ms) 1140
33+
nonheap 234M 240M 0M 97.46%
34+
code_cache 46M 47M 240M 19.49%
35+
metaspace 167M 172M 0M 97.36%
36+
Runtime Tomcat
37+
os.name Mac OS X connector http-bio-8080
38+
os.version 10.10.5 QPS 0.00
39+
java.version 1.8.0_60 RT(ms) 1.13
40+
java.home error/s 0.00
41+
received/s 0B
42+
systemload.average 3.44 sent/s 0B
43+
processors 4 threadpool http-bio-8080
44+
uptime 16020s busy 0
45+
```
46+
47+
### Specification
48+
49+
* ID: thread ID in JVM (this is different from the nativeID in thread dump)
50+
* NAME: thread name
51+
* GROUP: group the thread is in
52+
* STATE: the current state of the thread
53+
* PRIORITY: within 1 ~ 10 (the higher the number, the higher the priority)
54+
* CPU%: CPU usage ratio within 100ms
55+
* TIME: total running time in minute:second format
56+
* INTERRUPTED: the thread interrupted state
57+
* DAEMON: is daemon thread or not
58+
59+
### Screenshots
60+
61+
![alt text](../_static/dashboard.png "dashboard")

‎site/src/site/sphinx/en/dump.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dump
2+
===
3+
4+
Dump the bytecode the loaded classes to a specified directory.
5+
6+
### Options
7+
8+
|Name|Specification|
9+
|---:|:---|
10+
|*class-pattern*|pattern for the class name|
11+
|`[c:]`|hashcode of the class loader that loaded the class|
12+
|[E]|turn on regx matching while the default is wildcards matching|
13+
14+
### Usage
15+
16+
```shell
17+
$ dump -E org\.apache\.commons\.lang\.StringUtils
18+
HASHCODE CLASSLOADER LOCATION
19+
29505d69 +-tddl-client's ModuleClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.pandora
20+
.service.loader.ModuleClassLoader-29505d69/org.apache.commons.lang.StringUtils.class
21+
6e51ad67 +-java.net.URLClassLoader@6e51ad67 /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassL
22+
+-sun.misc.Launcher$AppClassLoader@6951a712 oader-6e51ad67/org.apache.commons.lang.StringUtils.class
23+
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
24+
2bdd9114 +-pandora-qos-service's ModuleClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.pandora
25+
.service.loader.ModuleClassLoader-2bdd9114/org.apache.commons.lang.StringUtils.class
26+
544dc9ba +-com.taobao.tomcat.container.context.loader.AliWebappClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.tomcat.
27+
+-org.apache.catalina.loader.StandardClassLoader@2302e984 container.context.loader.AliWebappClassLoader-544dc9ba/org.apache.commons.lang.String
28+
+-sun.misc.Launcher$AppClassLoader@6951a712 Utils.class
29+
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
30+
22880c2b +-java.net.URLClassLoader@22880c2b /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassL
31+
+-sun.misc.Launcher$AppClassLoader@6951a712 oader-22880c2b/org.apache.commons.lang.StringUtils.class
32+
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
33+
Affect(row-cnt:5) cost in 156 ms.
34+
$ dump -E org\.apache\.commons\.lang\.StringUtils -c 22880c2b
35+
HASHCODE CLASSLOADER LOCATION
36+
22880c2b +-java.net.URLClassLoader@22880c2b /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassLoader-22880c2b/org
37+
+-sun.misc.Launcher$AppClassLoader@6951a712 .apache.commons.lang.StringUtils.class
38+
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
39+
Affect(row-cnt:1) cost in 67 ms.
40+
```

‎site/src/site/sphinx/en/getstatic.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
getstatic
2+
=========
3+
4+
Check the static fields of classes conveniently as `getstatic class_name field_name`
5+
6+
Tip: if the *field* is a composite object, you can even use [`OGNL`](https://en.wikipedia.org/wiki/OGNL) to traverse, filter and access the internal properties of it.
7+
8+
E.g. suppose `n` is a `Map` and the key is a `Enum` then if you want to get the key with a specific `Enum` value - `STOP` or `a`, you can achieve it as:
9+
10+
```
11+
$ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}'
12+
field: n
13+
@ArrayList[
14+
@Node[STOP=bbb],
15+
]
16+
Affect(row-cnt:1) cost in 68 ms.
17+
18+
19+
$ getstatic com.alibaba.arthas.Test m 'entrySet().iterator.{? #this.key=="a"}'
20+
field: m
21+
@ArrayList[
22+
@Node[a=aaa],
23+
]
24+
```

‎site/src/site/sphinx/en/index.md

+32-19
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
11
Arthas Documentation
22
===
33

4-
## Arthas(阿尔萨斯) 能为你做什么?
4+
**[中文文档/Chinese Docs](https://alibaba.github.io/arthas/)**
55

66
![arthas](arthas.png)
77

8-
`Arthas` 是Alibaba开源的Java诊断工具,深受开发者喜爱。
8+
`Arthas` is an Java Diagnostic tool open sourced by Alibaba.
99

10-
当你遇到以下类似问题而束手无策时,`Arthas`可以帮助你解决:
10+
Arthas can help developer trouble-shooting production issues for Java applications without modifying your code or restating your server.
1111

12-
0. 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception?
13-
0. 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了?
14-
0. 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗?
15-
0. 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现!
16-
0. 是否有一个全局视角来查看系统的运行状况?
17-
0. 有什么办法可以监控到JVM的实时运行状态?
12+
### Background
1813

19-
`Arthas`采用命令行交互模式,同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。
14+
In production system, sometimes the networks is unreachable from local development environment. If you encounter some issues in production system, it is impossible to use IDE to debug the application remotely. More importantly, debugging in production is unacceptable, because it will suspend all the threads, which leads to business unavailability.
15+
16+
Some may think of reproducing the same issue on the test/staging environment, however, some tricky issue either can hardly be reproduced on a different environment, or even disappeared once restarted.
17+
18+
Thinking of adding some logs to your code? You have to go through test, staging, and then on to production. Time is money! That is a lot inefficient! Besides, the issue may not be reproducible once restart your JVM, as described above.
19+
20+
Arthas is born to solve these issues. You can trouble-shoot your production issue on-the-fly. No JVM restart, no additional code changes. Arthas works as an observer, which will never suspend your existing threads.
21+
22+
### Key features
23+
24+
* Check whether a class is loaded? And whether is class loaded from? (Useful for trouble-shooting jar file conflicts)
25+
* Decompile a class to ensure the code is running as expected.
26+
* View classloader statistics, e.g. how may classloaders are there? how many class is loaded per classloader? What is the classloader hierarchy? Is there possible classloader leaks?
27+
* View the method invocation details, e.g. method parameter, return object, thrown exception, and etc.
28+
* Check the stack trace of specified method invocation. This is useful when you would like to know who is calling your method?
29+
* Trace the method invocation to find slow sub-invocations.
30+
* Monitor method invcation statistics, e.g. qps, rt, success rate and etc.
31+
* Monitoring your system metrics, thread states and cpu usage, gc statistics, and etc.
32+
* Support command line interactive mode, with auto completed feature enabled.
33+
* Support telnet and websocket, which enables both local and remote diagnostics with command line and browsers.
2034

2135

2236
Contents
2337
--------
2438

25-
* [安装](install-detail.md)
26-
* [快速入门](quick-start.md)
27-
* [进阶使用](advanced-use.md)
28-
* [命令列表](commands.md)
29-
* [用户案例](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
39+
English version is on the way, if you would like to contribute, please leave a message [here](https://github.com/alibaba/arthas/issues/51)
40+
41+
* [Installation](install-detail.md)
42+
* [Quick start](quick-start.md)
43+
* [Advanced usage](advanced-use.md)
44+
* [Commands](commands.md)
45+
* [User cases](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
3046
* [Release Notes](release-notes.md)
3147
* [Questions and answers](https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered)
3248
* [Fork me at GitHub](https://github.com/alibaba/arthas)
33-
* [参与贡献](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)
34-
35-
36-
49+
* [CONTRIBUTING](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)

‎site/src/site/sphinx/en/install-detail.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,23 @@ If in Windows, the color is not working as expect. You can try [conemu](https://
4040

4141
If you cannot boot Arthas, try to pass in all the critical options manually as the following steps:
4242

43-
### 1. locate the java for JVM:
44-
- Linux/Unix/Mac: `ps aux | grep java`
45-
- Windows: open the Process Monitor to search java
43+
1. locate the java for JVM:
4644

47-
### 2. Concatenate the command
48-
Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
45+
- Linux/Unix/Mac: `ps aux | grep java`
46+
- Windows: open the Process Monitor to search java
4947

50-
```bash
51-
/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar \
52-
-jar /tmp/arthas-packaging/arthas-core.jar \
53-
-pid 15146 \
54-
-target-ip 127.0.0.1 -telnet-port 3658 -http-port 8563 \
55-
-core /tmp/arthas-packaging/arthas-core.jar \
56-
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
57-
```
48+
2. Concatenate the command
49+
50+
Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
51+
52+
```bash
53+
/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar \
54+
-jar /tmp/arthas-packaging/arthas-core.jar \
55+
-pid 15146 \
56+
-target-ip 127.0.0.1 -telnet-port 3658 -http-port 8563 \
57+
-core /tmp/arthas-packaging/arthas-core.jar \
58+
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
59+
```
5860

5961
* `-Xbootclasspath` add tools.jar
6062
* `-jar /tmp/arthas-packaging/arthas-core.jar` specify main entry
@@ -64,17 +66,17 @@ Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
6466
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` specify core/agent jar package
6567

6668

67-
But if you are using JDK 1.9 or above,then you do not need to add `tools.jar` in option `-Xbootclasspath`.
69+
But if you are using JDK 1.9 or above,then you do not need to add `tools.jar` in option `-Xbootclasspath`.
6870

69-
F.Y.I the booting log will be printed to `~/logs/arthas/arthas.log`.
71+
F.Y.I the booting log will be printed to `~/logs/arthas/arthas.log`.
7072

71-
### 3. Connect via telnet
73+
3. Connect via telnet
7274

73-
When attached successfully, you can connect it with
75+
When attached successfully, you can connect it with
7476

75-
```bash
76-
telnet localhost 3658
77-
```
77+
```bash
78+
telnet localhost 3658
79+
```
7880

7981
## Offline Help Documentation
8082

‎site/src/site/sphinx/en/jad.md

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
jad
2+
===
3+
4+
De-compile specified loaded classes.
5+
6+
`jad` helps to *de-compile* the byte code in JVM to the source code to assist you to better understand the logic behind.
7+
8+
F.Y.I
9+
* the de-compiled code will be grammatically highlighted for readability in Arthas Console;
10+
* you have to understand there might be some trivial grammar errors but it won't affect the logic understanding.
11+
12+
### Options
13+
14+
|Name|Specification|
15+
|---:|:---|
16+
|*class-pattern*|pattern for the class name|
17+
|`[c:]`|hashcode of the class loader that loaded the class|
18+
|[E]|turn on regx matching while the default is wildcards matching|
19+
20+
### Usage
21+
22+
When several class loaders loaded the same class:
23+
1. `jad` to get the hashcode of the class loader;
24+
2. `jad -c <hashcode>` to get the de-compiled class loaded by the class loader.
25+
26+
```java
27+
$ jad org.apache.log4j.Logger
28+
29+
Found more than one class for: org.apache.log4j.Logger, Please use jad -c hashcode org.apache.log4j.Logger
30+
HASHCODE CLASSLOADER
31+
69dcaba4 +-monitor's ModuleClassLoader
32+
6e51ad67 +-java.net.URLClassLoader@6e51ad67
33+
+-sun.misc.Launcher$AppClassLoader@6951a712
34+
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
35+
2bdd9114 +-pandora-qos-service's ModuleClassLoader
36+
4c0df5f8 +-pandora-framework's ModuleClassLoader
37+
38+
Affect(row-cnt:0) cost in 38 ms.
39+
$ jad org.apache.log4j.Logger -c 69dcaba4
40+
41+
ClassLoader:
42+
+-monitor's ModuleClassLoader
43+
44+
Location:
45+
/Users/zhuyong/Downloads/taobao-hsf.sar/plugins/monitor/lib/log4j-1.2.14.jar
46+
47+
package org.apache.log4j;
48+
49+
import org.apache.log4j.spi.*;
50+
51+
public class Logger extends Category
52+
{
53+
private static final String FQCN;
54+
55+
protected Logger(String name)
56+
{
57+
super(name);
58+
}
59+
60+
public static Logger getLogger(String name)
61+
{
62+
return LogManager.getLogger(name);
63+
}
64+
65+
public static Logger getLogger(Class clazz)
66+
{
67+
return LogManager.getLogger(clazz.getName());
68+
}
69+
70+
public static Logger getRootLogger()
71+
{
72+
return LogManager.getRootLogger();
73+
}
74+
75+
public static Logger getLogger(String name, LoggerFactory factory)
76+
{
77+
return LogManager.getLogger(name, factory);
78+
}
79+
80+
public void trace(Object message)
81+
{
82+
if (repository.isDisabled(5000))
83+
{
84+
return;
85+
}
86+
if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel()))
87+
{
88+
forcedLog(Logger.FQCN, Level.TRACE, message, null);
89+
}
90+
}
91+
92+
public void trace(Object message, Throwable t)
93+
{
94+
if (repository.isDisabled(5000))
95+
{
96+
return;
97+
}
98+
if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel()))
99+
{
100+
forcedLog(Logger.FQCN, Level.TRACE, message, t);
101+
}
102+
}
103+
104+
public boolean isTraceEnabled()
105+
{
106+
if (repository.isDisabled(5000))
107+
{
108+
return false;
109+
}
110+
return Level.TRACE.isGreaterOrEqual(getEffectiveLevel());
111+
}
112+
113+
static
114+
{
115+
Logger.FQCN = Logger.class.getName();
116+
}
117+
118+
}
119+
120+
Affect(row-cnt:1) cost in 190 ms.
121+
```
122+
123+
De-compile the specified method:
124+
125+
```sh
126+
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
127+
128+
ClassLoader:
129+
+-com.taobao.pandora.boot.loader.ReLaunchURLClassLoader@1817d444
130+
+-sun.misc.Launcher$AppClassLoader@14dad5dc
131+
+-sun.misc.Launcher$ExtClassLoader@a38d7a3
132+
133+
Location:
134+
/Users/zhuyong/middleware/tomcat-web/tomcat-web-web/target/classes/
135+
136+
private Map<String, Object> directMetrics(String ip, String[] metrics) {
137+
JSONObject obj;
138+
HashMap<String, Object> result = new HashMap<String, Object>();
139+
result.put("success", false);
140+
String metricUrl = "http://" + ip + ":8006/metrics/specific";
141+
String postBody = Arrays.stream(metrics).map(metric -> "metric=" + metric).collect(Collectors.joining("&"));
142+
HttpClientUtils.Response resp = HttpClientUtils.sendPostRequest((String)metricUrl, (String)postBody);
143+
if (resp.isSuccess() && (obj = JSON.parseObject(resp.getContent())).containsKey("success") && obj.getBoolean("success").booleanValue() && obj.containsKey("data")) {
144+
JSONArray dataArray = obj.getJSONArray("data");
145+
HashMap<String, Object> metricMap = new HashMap<String, Object>();
146+
for (Object aDataArray : dataArray) {
147+
JSONObject o = (JSONObject)aDataArray;
148+
metricMap.put(o.getString("metric"), o.get("value"));
149+
}
150+
result.put("data", metricMap);
151+
result.put("success", true);
152+
return result;
153+
}
154+
return result;
155+
}
156+
157+
Affect(row-cnt:1) cost in 1508 ms.
158+
```

‎site/src/site/sphinx/en/jvm.md

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
jvm
2+
===
3+
4+
Check the JVM profile
5+
6+
### Usage
7+
8+
```
9+
$ jvm
10+
CATEGORY INFO
11+
------------------------------------------------------------------------------------------------------------------------------------
12+
13+
RUNTIME MACHINE-NAME hellodeMacBook-Air.local
14+
JVM-START-TIME 2015-12-23 10:54:18
15+
MANAGEMENT-SPEC-VERSION 1.2
16+
SPEC-NAME Java Virtual Machine Specification
17+
SPEC-VENDOR Oracle Corporation
18+
SPEC-VERSION 1.8
19+
VM-NAME Java HotSpot(TM) 64-Bit Server VM
20+
VM-VENDOR Oracle Corporation
21+
VM-VERSION 25.60-b23
22+
INPUT-ARGUMENTS -Xbootclasspath/a:/Users/hello/.jenv/versions/1.8/lib/tools.jar
23+
-Djava.util.logging.config.file=/Users/hello/code/java/crash/packaging/target/
24+
conf/logging.properties
25+
26+
CLASS-PATH /Users/hello/.jenv/versions/1.8/lib/tools.jar:/Users/hello/code/java/cras
27+
h/packaging/target/bin/crash.cli-1.3.2-SNAPSHOT.jar::/Users/hello/code/java/cr
28+
ash/packaging/target/lib/bcpkix-jdk15on-1.51.jar:/Users/hello/code/java/crash/
29+
packaging/target/lib/bcprov-jdk15on-1.51.jar:/Users/hello/code/java/crash/pack
30+
aging/target/lib/crash.connectors.ssh-1.3.2-SNAPSHOT-standalone.jar:/Users/hengyuna
31+
bc/code/java/crash/packaging/target/lib/crash.connectors.telnet-1.3.2-SNAPSHOT-stan
32+
dalone.jar:/Users/hello/code/java/crash/packaging/target/lib/crash.shell-1.3.2
33+
-SNAPSHOT.jar:/Users/hello/code/java/crash/packaging/target/lib/groovy-all-1.8
34+
.9.jar:/Users/hello/code/java/crash/packaging/target/lib/ivy-2.2.0.jar
35+
BOOT-CLASS-PATH /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/resources.j
36+
ar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar:/
37+
Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/sunrsasign.j
38+
ar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jsse.jar
39+
:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jce.jar:/L
40+
ibrary/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/charsets.jar:
41+
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jfr.jar:/Li
42+
brary/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/classes:/Users/hen
43+
gyunabc/.jenv/versions/1.8/lib/tools.jar
44+
LIBRARY-PATH /Users/hello/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library
45+
/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
46+
47+
CLASS-LOADING LOADED-CLASS-COUNT 4264
48+
TOTAL-LOADED-CLASS-COUNT 4264
49+
UNLOADED-CLASS-COUNT 0
50+
IS-VERBOSE false
51+
52+
COMPILATION NAME HotSpot 64-Bit Tiered Compilers
53+
TOTAL-COMPILE-TIME 5145(ms)
54+
55+
GARBAGE-COLLECTORS PS Scavenge 6/74(ms)
56+
[count/time]
57+
PS MarkSweep 1/64(ms)
58+
[count/time]
59+
60+
MEMORY-MANAGERS CodeCacheManager Code Cache
61+
62+
Metaspace Manager Metaspace
63+
Compressed Class Space
64+
65+
PS Scavenge PS Eden Space
66+
PS Survivor Space
67+
68+
PS MarkSweep PS Eden Space
69+
PS Survivor Space
70+
PS Old Gen
71+
72+
73+
MEMORY HEAP-MEMORY-USAGE 186646528/134217728/1908932608/31245568
74+
[committed/init/max/used]
75+
NO-HEAP-MEMORY-USAGE 35520512/2555904/-1/34584616
76+
[committed/init/max/used]
77+
PENDING-FINALIZE-COUNT 0
78+
79+
OPERATING-SYSTEM OS Mac OS X
80+
ARCH x86_64
81+
PROCESSORS-COUNT 4
82+
LOAD-AVERAGE 2.328125
83+
VERSION 10.10.5
84+
85+
THREAD COUNT 16
86+
DAEMON-COUNT 10
87+
LIVE-COUNT 18
88+
STARTED-COUNT 19
89+
Affect cost in 2 ms.
90+
```
91+
92+
### thread-related
93+
94+
* COUNT: the count of active threads
95+
* DAEMON-COUNT: the count of active daemon threads
96+
* LIVE-COUNT: the maximum count of the live threads since JVM starts
97+
* STARTED-COUNT: the total count of the created threads since JVM starts

‎site/src/site/sphinx/en/sc.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
sc
2+
==
3+
4+
Check the profiles of the loaded classes.
5+
6+
Abbreviated from “Search-Class”; with the help of this command, you can search out all the loaded classes in JVM. Supported options are: `[d]``[E]``[f]` and `[x:]`.
7+
8+
Options
9+
-------
10+
11+
### Specification
12+
13+
|Name|Specification|
14+
|---:|:---|
15+
|*class-pattern*|pattern for the class name|
16+
|*method-pattern*|pattern for the method name|
17+
|[d]|print the details of the current class including the source file, class declaration, the class loaders and the like.<br/>F.Y.I if a class is loaded by several class loaders, then the class will be printed several times|
18+
|[E]|turn on regx matching while the default is wildcards matching|
19+
|[f]|print the fields info of the current class, which should be used along with `-d`|
20+
|[x:]|the depth to print the static fields, whose default is `0` - directly invoke the `toString()`|
21+
22+
Tip:
23+
1. *class-patten* supports full qualified class name (e.g. com.taobao.test.AAA and com/taobao/test/AAA)
24+
2. `sc` turned on the `sub-class` matching in default mode, if you do want to hide the `sub-class` please just turn it off via `options disable-sub-class true`.
25+
26+
### Usage
27+
28+
Check the static fields of a class using `sc -df class-name`
29+
30+
```shell
31+
$ sc -df org.apache.commons.lang.StringUtils
32+
33+
class-info org.apache.commons.lang.StringUtils
34+
code-source /Users/zhuyong/middleware/citrus-sample/petstore/web/target/petstore/WEB-INF/lib/commons-lang-2.4.jar
35+
name org.apache.commons.lang.StringUtils
36+
isInterface false
37+
isAnnotation false
38+
isEnum false
39+
isAnonymousClass false
40+
isArray false
41+
isLocalClass false
42+
isMemberClass false
43+
isPrimitive false
44+
isSynthetic false
45+
simple-name StringUtils
46+
modifier public
47+
annotation
48+
interfaces
49+
super-class +-java.lang.Object
50+
class-loader +-com.taobao.tomcat.container.context.loader.AliWebappClassLoader
51+
+-org.apache.catalina.loader.StandardClassLoader@1d44eef3
52+
+-sun.misc.Launcher$AppClassLoader@57a462c9
53+
+-sun.misc.Launcher$ExtClassLoader@6951a712
54+
fields modifier final,public,static
55+
type java.lang.String
56+
name EMPTY
57+
value
58+
59+
modifier final,public,static
60+
type int
61+
name INDEX_NOT_FOUND
62+
value -1
63+
64+
modifier final,private,static
65+
type int
66+
name PAD_LIMIT
67+
value 8192
68+
```

‎site/src/site/sphinx/en/sm.md

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
sm
2+
==
3+
4+
Check the method profile of the loaded classes;
5+
6+
Abbreviated from “Search-Method”, with which you can search out all methods profiles of the loaded classes.
7+
8+
F.Y.I
9+
`sm` only shows the methods declared in the current class; methods declared in ancestors will not be presented.
10+
11+
### Options
12+
13+
|Name|Specification|
14+
|---:|:---|
15+
|*class-pattern*|pattern for class name|
16+
|*method-pattern*|pattern for method name|
17+
|[d]|print the details of the method|
18+
|[E]|turn the regex matching on while the default mode is wildcards matching|
19+
20+
### Usage
21+
22+
```
23+
$ sm org.apache.catalina.connector.Connector
24+
org.apache.catalina.connector.Connector-><init>
25+
org.apache.catalina.connector.Connector->setProperty
26+
org.apache.catalina.connector.Connector->getProperty
27+
org.apache.catalina.connector.Connector->toString
28+
org.apache.catalina.connector.Connector->resume
29+
org.apache.catalina.connector.Connector->getScheme
30+
org.apache.catalina.connector.Connector->getProtocol
31+
org.apache.catalina.connector.Connector->getPort
32+
org.apache.catalina.connector.Connector->setService
33+
org.apache.catalina.connector.Connector->setPort
34+
org.apache.catalina.connector.Connector->getService
35+
org.apache.catalina.connector.Connector->getAttribute
36+
org.apache.catalina.connector.Connector->setAttribute
37+
org.apache.catalina.connector.Connector->getLocalPort
38+
org.apache.catalina.connector.Connector->pause
39+
org.apache.catalina.connector.Connector->setProtocol
40+
org.apache.catalina.connector.Connector->initInternal
41+
org.apache.catalina.connector.Connector->setSecure
42+
org.apache.catalina.connector.Connector->getSecure
43+
org.apache.catalina.connector.Connector->startInternal
44+
org.apache.catalina.connector.Connector->stopInternal
45+
org.apache.catalina.connector.Connector->setScheme
46+
org.apache.catalina.connector.Connector->createRequest
47+
org.apache.catalina.connector.Connector->getDomainInternal
48+
org.apache.catalina.connector.Connector->getProtocolHandler
49+
org.apache.catalina.connector.Connector->setURIEncoding
50+
org.apache.catalina.connector.Connector->findSslHostConfigs
51+
org.apache.catalina.connector.Connector->destroyInternal
52+
org.apache.catalina.connector.Connector->getObjectNameKeyProperties
53+
org.apache.catalina.connector.Connector->getAllowTrace
54+
org.apache.catalina.connector.Connector->setAllowTrace
55+
org.apache.catalina.connector.Connector->getAsyncTimeout
56+
org.apache.catalina.connector.Connector->setAsyncTimeout
57+
org.apache.catalina.connector.Connector->getEnableLookups
58+
org.apache.catalina.connector.Connector->setEnableLookups
59+
org.apache.catalina.connector.Connector->getMaxCookieCount
60+
...
61+
62+
```
63+
64+
```sh
65+
$ sm org.apache.catalina.connector.Connector -d
66+
declaring-class org.apache.catalina.connector.Connector
67+
constructor-name <init>
68+
modifier public
69+
annotation
70+
parameters
71+
exceptions
72+
73+
declaring-class org.apache.catalina.connector.Connector
74+
constructor-name <init>
75+
modifier public
76+
annotation
77+
parameters java.lang.String
78+
exceptions
79+
80+
declaring-class org.apache.catalina.connector.Connector
81+
method-name setProperty
82+
modifier public
83+
annotation
84+
parameters java.lang.String
85+
java.lang.String
86+
return boolean
87+
exceptions
88+
......
89+
```

‎site/src/site/sphinx/en/sysprop.md

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
sysprop
2+
=======
3+
4+
Check the JVM system properties.
5+
6+
### Usage
7+
8+
```
9+
USAGE:
10+
sysprop [-h] [property-name] [property-value]
11+
12+
SUMMARY:
13+
Display, and change all the system properties.
14+
15+
EXAMPLES:
16+
sysprop
17+
sysprop file.encoding
18+
sysprop production.mode true
19+
20+
WIKI:
21+
https://alibaba.github.io/arthas/sysprop
22+
23+
OPTIONS:
24+
-h, --help this help
25+
<property-name> property name
26+
<property-value> property value
27+
```
28+
29+
#### Check all properties
30+
31+
32+
```
33+
$ sysprop
34+
KEY VALUE
35+
-------------------------------------------------------------------------------------------------------------------------------------
36+
java.runtime.name Java(TM) SE Runtime Environment
37+
sun.boot.library.path /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib
38+
java.vm.version 25.51-b03
39+
user.country.format CN
40+
gopherProxySet false
41+
java.vm.vendor Oracle Corporation
42+
java.vendor.url http://java.oracle.com/
43+
path.separator :
44+
java.vm.name Java HotSpot(TM) 64-Bit Server VM
45+
file.encoding.pkg sun.io
46+
user.country US
47+
sun.java.launcher SUN_STANDARD
48+
sun.os.patch.level unknown
49+
java.vm.specification.name Java Virtual Machine Specification
50+
user.dir /private/var/tmp
51+
java.runtime.version 1.8.0_51-b16
52+
java.awt.graphicsenv sun.awt.CGraphicsEnvironment
53+
java.endorsed.dirs /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/endors
54+
ed
55+
os.arch x86_64
56+
java.io.tmpdir /var/folders/2c/tbxwzs4s4sbcvh7frbcc7n000000gn/T/
57+
line.separator
58+
59+
java.vm.specification.vendor Oracle Corporation
60+
os.name Mac OS X
61+
sun.jnu.encoding UTF-8
62+
java.library.path /Users/wangtao/Library/Java/Extensions:/Library/Java/Extensions:/Network/Libra
63+
ry/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
64+
sun.nio.ch.bugLevel
65+
java.specification.name Java Platform API Specification
66+
java.class.version 52.0
67+
sun.management.compiler HotSpot 64-Bit Tiered Compilers
68+
os.version 10.12.6
69+
user.home /Users/wangtao
70+
user.timezone Asia/Shanghai
71+
java.awt.printerjob sun.lwawt.macosx.CPrinterJob
72+
file.encoding UTF-8
73+
java.specification.version 1.8
74+
user.name wangtao
75+
java.class.path .
76+
java.vm.specification.version 1.8
77+
sun.arch.data.model 64
78+
java.home /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
79+
sun.java.command Test
80+
java.specification.vendor Oracle Corporation
81+
user.language en
82+
awt.toolkit sun.lwawt.macosx.LWCToolkit
83+
java.vm.info mixed mode
84+
java.version 1.8.0_51
85+
java.ext.dirs /Users/wangtao/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.
86+
8.0_51.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library
87+
/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
88+
sun.boot.class.path /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/resour
89+
ces.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/li
90+
b/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/l
91+
ib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/H
92+
ome/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Content
93+
s/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Conte
94+
nts/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jd
95+
k/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.
96+
jdk/Contents/Home/jre/classes
97+
java.vendor Oracle Corporation
98+
file.separator /
99+
java.vendor.url.bug http://bugreport.sun.com/bugreport/
100+
sun.cpu.endian little
101+
sun.io.unicode.encoding UnicodeBig
102+
sun.cpu.isalist
103+
```
104+
105+
#### Check a single property
106+
107+
Tip: `tab` auto-completion supported
108+
109+
```
110+
$ sysprop java.version
111+
java.version=1.8.0_51
112+
```
113+
114+
#### Modify a single property
115+
116+
```
117+
$ sysprop user.country
118+
user.country=US
119+
$ sysprop user.country CN
120+
Successfully changed the system property.
121+
user.country=CN
122+
```

‎site/src/site/sphinx/en/thread.md

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
thread
2+
======
3+
4+
Check the basic profile and stack trace of the threads.
5+
6+
### Parameters
7+
8+
|Name|Specification|
9+
|---:|:---|
10+
|*id*|thread id in JVM|
11+
|[n:]|the top n busiest with stack traces|
12+
|[b]|locate the threads blocking others|
13+
|[i `<value>`]|specify the interval to collect data to compute CPU ratios (ms)|
14+
15+
How to get the CPU ratios?
16+
17+
> Within an *specified* interval, the time cost by the thread compared to the total CPU time.
18+
> Take a sample (using `java.lang.management.ThreadMXBean#getThreadCpuTime`) to get the CPU time cost for all the threads and after a *specified* interval (default *100 ms*, which can be specified by `-i`), take another sample and we have the CPU time cost and the ratios naturally.
19+
20+
> Attention: this kind of operation will take time, to decrease the extra cost, you'd better expand the interval to like `5000 ms` for less performance overhead.
21+
22+
F.Y.I
23+
24+
If you'd like to check the CPU ratios from the very start of the Java process, [show-busy-java-threads](https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads) can be a help.
25+
26+
### Usage
27+
28+
#### List the top n busiest with detailed stack trace
29+
30+
```shell
31+
$ thread -n 3
32+
"as-command-execute-daemon" Id=29 cpuUsage=75% RUNNABLE
33+
at sun.management.ThreadImpl.dumpThreads0(Native Method)
34+
at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:440)
35+
at com.taobao.arthas.core.command.monitor200.ThreadCommand$1.action(ThreadCommand.java:58)
36+
at com.taobao.arthas.core.command.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:238)
37+
at com.taobao.arthas.core.command.handler.DefaultCommandHandler.handleCommand(DefaultCommandHandler.java:67)
38+
at com.taobao.arthas.core.server.ArthasServer$4.run(ArthasServer.java:276)
39+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
40+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
41+
at java.lang.Thread.run(Thread.java:745)
42+
43+
Number of locked synchronizers = 1
44+
- java.util.concurrent.ThreadPoolExecutor$Worker@6cd0b6f8
45+
46+
47+
48+
"as-session-expire-daemon" Id=25 cpuUsage=24% TIMED_WAITING
49+
at java.lang.Thread.sleep(Native Method)
50+
at com.taobao.arthas.core.server.DefaultSessionManager$2.run(DefaultSessionManager.java:85)
51+
52+
53+
54+
"Reference Handler" Id=2 cpuUsage=0% WAITING on java.lang.ref.Reference$Lock@69ba0f27
55+
at java.lang.Object.wait(Native Method)
56+
- waiting on java.lang.ref.Reference$Lock@69ba0f27
57+
at java.lang.Object.wait(Object.java:503)
58+
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
59+
```
60+
61+
#### List all info when no options provided
62+
63+
```shell
64+
$ thread
65+
Threads Total: 16, NEW: 0, RUNNABLE: 7, BLOCKED: 0, WAITING: 5, TIMED_WAITING: 4, TERMINATED: 0
66+
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTE DAEMON
67+
30 as-command-execute-daemon system 9 RUNNABLE 72 0:0 false true
68+
23 as-session-expire-daemon system 9 TIMED_WAIT 27 0:0 false true
69+
22 Attach Listener system 9 RUNNABLE 0 0:0 false true
70+
11 pool-2-thread-1 main 5 TIMED_WAIT 0 0:0 false false
71+
12 Thread-2 main 5 RUNNABLE 0 0:0 false true
72+
13 pool-3-thread-1 main 5 TIMED_WAIT 0 0:0 false false
73+
25 as-selector-daemon system 9 RUNNABLE 0 0:0 false true
74+
14 Thread-3 main 5 TIMED_WAIT 0 0:0 false false
75+
26 pool-5-thread-1 system 5 WAITING 0 0:0 false false
76+
15 Thread-4 main 5 RUNNABLE 0 0:0 false false
77+
1 main main 5 WAITING 0 0:2 false false
78+
2 Reference Handler system 10 WAITING 0 0:0 false true
79+
3 Finalizer system 8 WAITING 0 0:0 false true
80+
4 Signal Dispatcher system 9 RUNNABLE 0 0:0 false true
81+
20 NonBlockingInputStreamThread main 5 WAITING 0 0:0 false true
82+
21 Thread-8 main 5 RUNNABLE 0 0:0 false true
83+
```
84+
85+
#### thread <thread_id> present the specified thread profile
86+
87+
```shell
88+
$ thread 1
89+
"main" Id=1 WAITING on java.util.concurrent.CountDownLatch$Sync@29fafb28
90+
at sun.misc.Unsafe.park(Native Method)
91+
- waiting on java.util.concurrent.CountDownLatch$Sync@29fafb28
92+
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
93+
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
94+
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
95+
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
96+
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
97+
```
98+
99+
#### thread -b locate the blocking threads
100+
101+
Using `-b`, we can effectively locate the threads holding locks blocking other threads resulting in a frozen system.
102+
103+
```sh
104+
$ thread -b
105+
"http-bio-8080-exec-4" Id=27 TIMED_WAITING
106+
at java.lang.Thread.sleep(Native Method)
107+
at test.arthas.TestThreadBlocking.doGet(TestThreadBlocking.java:22)
108+
- locked java.lang.Object@725be470 <---- but blocks 4 other threads!
109+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
110+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
111+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
112+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
113+
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
114+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
115+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
116+
at test.filter.TestDurexFilter.doFilter(TestDurexFilter.java:46)
117+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
118+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
119+
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
120+
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
121+
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
122+
at com.taobao.tomcat.valves.ContextLoadFilterValve$FilterChainAdapter.doFilter(ContextLoadFilterValve.java:191)
123+
at com.taobao.eagleeye.EagleEyeFilter.doFilter(EagleEyeFilter.java:81)
124+
at com.taobao.tomcat.valves.ContextLoadFilterValve.invoke(ContextLoadFilterValve.java:150)
125+
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
126+
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
127+
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
128+
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:429)
129+
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
130+
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
131+
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
132+
- locked org.apache.tomcat.util.net.SocketWrapper@7127ee12
133+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
134+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
135+
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
136+
at java.lang.Thread.run(Thread.java:745)
137+
138+
Number of locked synchronizers = 1
139+
- java.util.concurrent.ThreadPoolExecutor$Worker@31a6493e
140+
```
141+
142+
> Attention: only `synchronized` blocked threads can be located for now, `JUL` not supported yet.
143+
144+
145+
#### thread -i specify the collecting interval
146+
147+
```sh
148+
$ thread -n 3 -i 1000
149+
"as-command-execute-daemon" Id=4759 cpuUsage=23% RUNNABLE
150+
at sun.management.ThreadImpl.dumpThreads0(Native Method)
151+
at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:440)
152+
at com.taobao.arthas.core.command.monitor200.ThreadCommand.processTopBusyThreads(ThreadCommand.java:133)
153+
at com.taobao.arthas.core.command.monitor200.ThreadCommand.process(ThreadCommand.java:79)
154+
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:96)
155+
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:27)
156+
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:125)
157+
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:122)
158+
at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:332)
159+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
160+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
161+
at java.lang.Thread.run(Thread.java:756)
162+
163+
Number of locked synchronizers = 1
164+
- java.util.concurrent.ThreadPoolExecutor$Worker@546aeec1
165+
...
166+
```

‎site/src/site/sphinx/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Arthas 用户文档
22
===
33

4+
**[English Docs](https://alibaba.github.io/arthas/en/)**
5+
46
## Arthas(阿尔萨斯) 能为你做什么?
57

68
![arthas](arthas.png)
@@ -22,6 +24,7 @@ Arthas 用户文档
2224
Contents
2325
--------
2426

27+
* [English Docs](https://alibaba.github.io/arthas/en/)
2528
* [安装](install-detail.md)
2629
* [快速入门](quick-start.md)
2730
* [进阶使用](advanced-use.md)

0 commit comments

Comments
 (0)
Please sign in to comment.