mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
fix(docs): refactor sidebar, support aplus (#2242)
This commit is contained in:
@@ -59,6 +59,7 @@ module.exports = [
|
||||
"Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas",
|
||||
},
|
||||
],
|
||||
// baidu analytics
|
||||
[
|
||||
"script",
|
||||
{},
|
||||
@@ -72,4 +73,26 @@ module.exports = [
|
||||
})();
|
||||
`,
|
||||
],
|
||||
// aplus
|
||||
[
|
||||
"meta",
|
||||
{
|
||||
name: "aes-config",
|
||||
content: "pid=xux-opensource&user_type=101&uid=&username=",
|
||||
},
|
||||
],
|
||||
[
|
||||
"script",
|
||||
{
|
||||
src: "//g.alicdn.com/alilog/mlog/aplus_v2.js",
|
||||
id: "beacon-aplus",
|
||||
exparams: "clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx",
|
||||
},
|
||||
],
|
||||
[
|
||||
"script",
|
||||
{
|
||||
src: "//g.alicdn.com/aes/??tracker/1.0.34/index.js,tracker-plugin-pv/2.4.5/index.js,tracker-plugin-event/1.2.5/index.js,tracker-plugin-jserror/1.0.13/index.js,tracker-plugin-api/1.1.14/index.js,tracker-plugin-perf/1.1.8/index.js,tracker-plugin-eventTiming/1.0.4/index.js",
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
@@ -12,6 +12,14 @@ module.exports = [
|
||||
text: "DOCS",
|
||||
link: "/en/doc",
|
||||
},
|
||||
{
|
||||
text: "COMMANDS",
|
||||
link: "/en/doc/commands.md",
|
||||
},
|
||||
{
|
||||
text: "DOWNLOAD",
|
||||
link: "/en/doc/download.md",
|
||||
},
|
||||
{
|
||||
text: "SOLUTIONS",
|
||||
children: [
|
||||
@@ -41,12 +49,4 @@ module.exports = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "DOWNLOAD",
|
||||
link: "/en/doc/download.md",
|
||||
},
|
||||
{
|
||||
text: "COMMANDS",
|
||||
link: "/en/doc/commands.md",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -12,6 +12,14 @@ module.exports = [
|
||||
text: "文档",
|
||||
link: "/doc/",
|
||||
},
|
||||
{
|
||||
text: "命令列表",
|
||||
link: "/doc/commands.md",
|
||||
},
|
||||
{
|
||||
text: "下载",
|
||||
link: "/doc/download.md",
|
||||
},
|
||||
{
|
||||
text: "解决方案",
|
||||
children: [
|
||||
@@ -41,12 +49,4 @@ module.exports = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "下载",
|
||||
link: "/doc/download.md",
|
||||
},
|
||||
{
|
||||
text: "命令列表",
|
||||
link: "/doc/commands.md",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -31,7 +31,58 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
"/en/doc/commands.md",
|
||||
{
|
||||
text: "All Commands",
|
||||
link: "/en/doc/commands.md",
|
||||
collapsible: true,
|
||||
children: [
|
||||
"/en/doc/dashboard.md",
|
||||
"/en/doc/getstatic.md",
|
||||
"/en/doc/heapdump.md",
|
||||
"/en/doc/jvm.md",
|
||||
"/en/doc/logger.md",
|
||||
"/en/doc/mbean.md",
|
||||
"/en/doc/memory.md",
|
||||
"/en/doc/ognl.md",
|
||||
"/en/doc/perfcounter.md",
|
||||
"/en/doc/sysenv.md",
|
||||
"/en/doc/sysprop.md",
|
||||
"/en/doc/thread.md",
|
||||
"/en/doc/vmoption.md",
|
||||
"/en/doc/vmtool.md",
|
||||
"/en/doc/classloader.md",
|
||||
"/en/doc/dump.md",
|
||||
"/en/doc/jad.md",
|
||||
"/en/doc/mc.md",
|
||||
"/en/doc/redefine.md",
|
||||
"/en/doc/retransform.md",
|
||||
"/en/doc/sc.md",
|
||||
"/en/doc/sm.md",
|
||||
"/en/doc/monitor.md",
|
||||
"/en/doc/stack.md",
|
||||
"/en/doc/trace.md",
|
||||
"/en/doc/tt.md",
|
||||
"/en/doc/watch.md",
|
||||
"/en/doc/profiler.md",
|
||||
"/en/doc/auth.md",
|
||||
"/en/doc/options.md",
|
||||
"/en/doc/base64.md",
|
||||
"/en/doc/cat.md",
|
||||
"/en/doc/cls.md",
|
||||
"/en/doc/echo.md",
|
||||
"/en/doc/grep.md",
|
||||
"/en/doc/help.md",
|
||||
"/en/doc/history.md",
|
||||
"/en/doc/keymap.md",
|
||||
"/en/doc/pwd.md",
|
||||
"/en/doc/quit.md",
|
||||
"/en/doc/reset.md",
|
||||
"/en/doc/session.md",
|
||||
"/en/doc/stop.md",
|
||||
"/en/doc/tee.md",
|
||||
"/en/doc/version.md",
|
||||
],
|
||||
},
|
||||
"/en/doc/web-console.md",
|
||||
"/en/doc/tunnel.md",
|
||||
"/en/doc/http-api.md",
|
||||
|
||||
@@ -35,7 +35,58 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
"/doc/commands.md",
|
||||
{
|
||||
text: "命令列表",
|
||||
link: "/doc/commands.md",
|
||||
collapsible: true,
|
||||
children: [
|
||||
"/doc/dashboard.md",
|
||||
"/doc/getstatic.md",
|
||||
"/doc/heapdump.md",
|
||||
"/doc/jvm.md",
|
||||
"/doc/logger.md",
|
||||
"/doc/mbean.md",
|
||||
"/doc/memory.md",
|
||||
"/doc/ognl.md",
|
||||
"/doc/perfcounter.md",
|
||||
"/doc/sysenv.md",
|
||||
"/doc/sysprop.md",
|
||||
"/doc/thread.md",
|
||||
"/doc/vmoption.md",
|
||||
"/doc/vmtool.md",
|
||||
"/doc/classloader.md",
|
||||
"/doc/dump.md",
|
||||
"/doc/jad.md",
|
||||
"/doc/mc.md",
|
||||
"/doc/redefine.md",
|
||||
"/doc/retransform.md",
|
||||
"/doc/sc.md",
|
||||
"/doc/sm.md",
|
||||
"/doc/monitor.md",
|
||||
"/doc/stack.md",
|
||||
"/doc/trace.md",
|
||||
"/doc/tt.md",
|
||||
"/doc/watch.md",
|
||||
"/doc/profiler.md",
|
||||
"/doc/auth.md",
|
||||
"/doc/options.md",
|
||||
"/doc/base64.md",
|
||||
"/doc/cat.md",
|
||||
"/doc/cls.md",
|
||||
"/doc/echo.md",
|
||||
"/doc/grep.md",
|
||||
"/doc/help.md",
|
||||
"/doc/history.md",
|
||||
"/doc/keymap.md",
|
||||
"/doc/pwd.md",
|
||||
"/doc/quit.md",
|
||||
"/doc/reset.md",
|
||||
"/doc/session.md",
|
||||
"/doc/stop.md",
|
||||
"/doc/tee.md",
|
||||
"/doc/version.md",
|
||||
],
|
||||
},
|
||||
"/doc/web-console.md",
|
||||
"/doc/tunnel.md",
|
||||
"/doc/http-api.md",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { usePageData } from "@vuepress/client";
|
||||
|
||||
function showRightMenu() {
|
||||
const pages = usePageData();
|
||||
return pages.value.headers.length > 1;
|
||||
return pages.value.headers.length > 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,23 +8,40 @@ SRC: https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/vdoing/compone
|
||||
<div class="right-menu-margin">
|
||||
<div class="right-menu-title">{{ menu }}</div>
|
||||
<div class="right-menu-content">
|
||||
<div
|
||||
:class="[
|
||||
'right-menu-item',
|
||||
'level' + item.level,
|
||||
{ active: item.slug === hashText },
|
||||
]"
|
||||
v-for="(item, i) in headers"
|
||||
:key="i"
|
||||
>
|
||||
<a
|
||||
:href="'#' + item.slug"
|
||||
v-if="item.title.replace(/[^\x00-\xff]/g, '01').length >= 27"
|
||||
:title="item.title"
|
||||
>{{ item.title }}</a
|
||||
<template v-for="(item, i) in headers" :key="i">
|
||||
<div
|
||||
:class="[
|
||||
'right-menu-item',
|
||||
'level' + item.level,
|
||||
{ active: item.slug === hashText },
|
||||
]"
|
||||
>
|
||||
<a :href="'#' + item.slug" v-else>{{ item.title }}</a>
|
||||
</div>
|
||||
<a
|
||||
:href="'#' + item.slug"
|
||||
v-if="item.title.replace(/[^\x00-\xff]/g, '01').length >= 27"
|
||||
:title="item.title"
|
||||
>{{ item.title }}</a
|
||||
>
|
||||
<a :href="'#' + item.slug" v-else>{{ item.title }}</a>
|
||||
</div>
|
||||
<div
|
||||
:class="[
|
||||
'right-menu-item',
|
||||
'level' + subItem.level,
|
||||
{ active: subItem.slug === hashText },
|
||||
]"
|
||||
v-for="(subItem, j) in item.children"
|
||||
:key="j"
|
||||
>
|
||||
<a
|
||||
:href="'#' + subItem.slug"
|
||||
v-if="subItem.title.replace(/[^\x00-\xff]/g, '01').length >= 27"
|
||||
:title="subItem.title"
|
||||
>{{ subItem.title }}</a
|
||||
>
|
||||
<a :href="'#' + subItem.slug" v-else>{{ subItem.title }}</a>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,6 +65,7 @@ menu.value = theme.value.rightMenuText ?? "Table of Contents";
|
||||
function getHeadersData() {
|
||||
headers.value = pages.value.headers;
|
||||
}
|
||||
|
||||
function getHashText() {
|
||||
hashText.value = decodeURIComponent(window.location.hash.slice(1));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息,并能在不修改应用代码的情况下,对业务问题进行诊断,包括查看方法调用的出入参、异常,监测方法执行耗时,类加载信息等,大大提升线上问题排查效率。
|
||||
|
||||
### Arthas(阿尔萨斯)能为你做什么?
|
||||
## Arthas(阿尔萨斯)能为你做什么?
|
||||
|
||||
`Arthas` 是 Alibaba 开源的 Java 诊断工具,深受开发者喜爱。
|
||||
|
||||
@@ -23,6 +23,6 @@ Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用
|
||||
|
||||
**如果您在使用 Arthas,请让我们知道,您的使用对我们非常重要:[查看](https://github.com/alibaba/arthas/issues/111)**
|
||||
|
||||
### Contributors
|
||||
## Contributors
|
||||
|
||||
[](https://github.com/alibaba/arthas/graphs/contributors)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
验证当前会话
|
||||
:::
|
||||
|
||||
### 配置用户名和密码
|
||||
## 配置用户名和密码
|
||||
|
||||
在 attach 时,可以在命令行指定密码。比如:
|
||||
|
||||
@@ -20,7 +20,7 @@ java -jar arthas-boot.jar --password ppp
|
||||
Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh
|
||||
```
|
||||
|
||||
### 本地连接不鉴权
|
||||
## 本地连接不鉴权
|
||||
|
||||
默认情况下,在`arthas.properties`文件里有配置:
|
||||
|
||||
@@ -30,7 +30,7 @@ arthas.localConnectionNonAuth=true
|
||||
|
||||
当配置密码时,使用本地连接,也不需要鉴权。默认配置值是 true,方便本地连接使用。只有远程连接时,才需要鉴权。
|
||||
|
||||
### 在 telnet console 里鉴权
|
||||
## 在 telnet console 里鉴权
|
||||
|
||||
连接到 arthas 后,直接执行命令会提示需要鉴权:
|
||||
|
||||
@@ -48,15 +48,15 @@ Authentication result: true
|
||||
|
||||
- 可以通过 `--username` 选项来指定用户,默认值是`arthas`。
|
||||
|
||||
### Web console 密码验证
|
||||
## Web console 密码验证
|
||||
|
||||
打开浏览器,会有弹窗提示需要输入 用户名 和 密码。
|
||||
|
||||
成功之后,则可以直接连接上 web console。
|
||||
|
||||
### HTTP API 验证
|
||||
## HTTP API 验证
|
||||
|
||||
#### Authorization Header 方式(推荐)
|
||||
### Authorization Header 方式(推荐)
|
||||
|
||||
Arthas 采用的是 HTTP 标准的 Basic Authorization,客户端请求时增加对应的 header 即可。
|
||||
|
||||
@@ -70,7 +70,7 @@ curl 'http://localhost:8563/api' \
|
||||
--data-raw '{"action":"exec","command":"version"}'
|
||||
```
|
||||
|
||||
#### URL 参数传递方式
|
||||
### URL 参数传递方式
|
||||
|
||||
为了方便各种特殊情况,支持了以 parameters 方式传递 username 和 password。比如:
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
base64 编码转换,和 linux 里的 base64 命令类似。
|
||||
:::
|
||||
|
||||
### 对文件进行 base64 编码
|
||||
## 对文件进行 base64 编码
|
||||
|
||||
```bash
|
||||
[arthas@70070]$ echo 'abc' > /tmp/test.txt
|
||||
@@ -15,20 +15,20 @@ abc
|
||||
YWJjCg==
|
||||
```
|
||||
|
||||
### 对文件进行 base64 编码并把结果保存到文件里
|
||||
## 对文件进行 base64 编码并把结果保存到文件里
|
||||
|
||||
```bash
|
||||
$ base64 --input /tmp/test.txt --output /tmp/result.txt
|
||||
```
|
||||
|
||||
### 用 base64 解码文件
|
||||
## 用 base64 解码文件
|
||||
|
||||
```
|
||||
$ base64 -d /tmp/result.txt
|
||||
abc
|
||||
```
|
||||
|
||||
### 用 base64 解码文件并保存结果到文件里
|
||||
## 用 base64 解码文件并保存结果到文件里
|
||||
|
||||
```bash
|
||||
$ base64 -d /tmp/result.txt --output /tmp/bbb.txt
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
通过批处理功能,arthas 支持一次性批量运行多个命令,并取得命令执行的结果。
|
||||
:::
|
||||
|
||||
### 使用方法
|
||||
## 使用方法
|
||||
|
||||
#### 第一步: 创建你的批处理脚本
|
||||
### 第一步: 创建你的批处理脚本
|
||||
|
||||
这里我们新建了一个`test.as`脚本,为了规范,我们采用了.as 后缀名,但事实上任意的文本文件都 ok。
|
||||
|
||||
@@ -27,7 +27,7 @@ thread
|
||||
sc -d org.apache.commons.lang.StringUtils
|
||||
```
|
||||
|
||||
#### 第二步: 运行你的批处理脚本
|
||||
### 第二步: 运行你的批处理脚本
|
||||
|
||||
通过`-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
|
||||
|
||||
@@ -41,7 +41,7 @@ sc -d org.apache.commons.lang.StringUtils
|
||||
./as.sh -c 'sysprop; thread' <pid> > test.out # pid 可以通过 jps 命令查看
|
||||
```
|
||||
|
||||
#### 第三步: 查看运行结果
|
||||
### 第三步: 查看运行结果
|
||||
|
||||
```bash
|
||||
cat test.out
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
打印文件内容,和 linux 里的 cat 命令类似。
|
||||
:::
|
||||
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ cat /tmp/a.txt
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
可以让指定的 classloader 去 getResources,打印出所有查找到的 resources 的 url。对于`ResourceNotFoundException`比较有用。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :----------------------------------------- |
|
||||
@@ -22,9 +22,9 @@
|
||||
| `[c: r:]` | 用 ClassLoader 去查找 resource |
|
||||
| `[c: load:]` | 用 ClassLoader 去加载指定的类 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 按类加载类型查看统计信息
|
||||
### 按类加载类型查看统计信息
|
||||
|
||||
```bash
|
||||
$ classloader
|
||||
@@ -37,7 +37,7 @@ $ classloader
|
||||
Affect(row-cnt:5) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### 按类加载实例查看统计信息
|
||||
### 按类加载实例查看统计信息
|
||||
|
||||
```bash
|
||||
$ classloader -l
|
||||
@@ -49,7 +49,7 @@ $ classloader -l
|
||||
Affect(row-cnt:4) cost in 2 ms.
|
||||
```
|
||||
|
||||
#### 查看 ClassLoader 的继承树
|
||||
### 查看 ClassLoader 的继承树
|
||||
|
||||
```bash
|
||||
$ classloader -t
|
||||
@@ -60,7 +60,7 @@ $ classloader -t
|
||||
Affect(row-cnt:4) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### 查看 URLClassLoader 实际的 urls
|
||||
### 查看 URLClassLoader 实际的 urls
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69
|
||||
@@ -82,7 +82,7 @@ file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar
|
||||
Affect(row-cnt:9) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### 使用 ClassLoader 去查找 resource
|
||||
### 使用 ClassLoader 去查找 resource
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69 -r META-INF/MANIFEST.MF
|
||||
@@ -98,7 +98,7 @@ $ classloader -c 1b6d3586 -r java/lang/String.class
|
||||
jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class
|
||||
```
|
||||
|
||||
#### 使用 ClassLoader 去加载类
|
||||
### 使用 ClassLoader 去加载类
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69 --load demo.MathGame
|
||||
@@ -125,7 +125,7 @@ load class success.
|
||||
classLoaderHash 3d4eac69
|
||||
```
|
||||
|
||||
#### 统计 ClassLoader 实际使用 URL 和未使用的 URL
|
||||
### 统计 ClassLoader 实际使用 URL 和未使用的 URL
|
||||
|
||||
::: warning
|
||||
注意,基于 JVM 目前已加载的所有类统计,不代表`Unused URLs`可以从应用中删掉。因为可能将来需要从`Unused URLs`里加载类,或者需要加载`resources`。
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
当运行在 Ali-tomcat 时,会显示当前 tomcat 的实时信息,如 HTTP 请求的 qps, rt, 错误数, 线程池信息等等。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| -------: | :--------------------------------------- |
|
||||
| [i:] | 刷新实时数据的时间间隔 (ms),默认 5000ms |
|
||||
| [n:] | 刷新实时数据的次数 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ dashboard
|
||||
@@ -52,7 +52,7 @@ processors 8
|
||||
uptime 272s
|
||||
```
|
||||
|
||||
### 数据说明
|
||||
## 数据说明
|
||||
|
||||
- ID: Java 级别的线程 ID,注意这个 ID 不能跟 jstack 中的 nativeID 一一对应。
|
||||
- NAME: 线程名
|
||||
@@ -65,7 +65,7 @@ uptime 272s
|
||||
- INTERRUPTED: 线程当前的中断位状态
|
||||
- DAEMON: 是否是 daemon 线程
|
||||
|
||||
#### JVM 内部线程
|
||||
### JVM 内部线程
|
||||
|
||||
Java 8 之后支持获取 JVM 内部线程 CPU 时间,这些线程只有名称和 CPU 时间,没有 ID 及状态等信息(显示 ID 为-1)。
|
||||
通过内部线程可以观测到 JVM 活动,如 GC、JIT 编译等占用 CPU 情况,方便了解 JVM 整体运行状况。
|
||||
@@ -79,6 +79,6 @@ JVM 内部线程包括下面几种:
|
||||
- GC 线程: 如`GC Thread0`, `G1 Young RemSet Sampling`
|
||||
- 其它内部线程: 如`VM Periodic Task Thread`, `VM Thread`, `Service Thread`
|
||||
|
||||
### 截图展示
|
||||
## 截图展示
|
||||
|
||||

|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
dump 已加载类的 bytecode 到特定目录
|
||||
:::
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :----------------------------------------- |
|
||||
@@ -16,7 +16,7 @@ dump 已加载类的 bytecode 到特定目录
|
||||
| `[d:]` | 设置类文件的目标目录 |
|
||||
| [E] | 开启正则表达式匹配,默认为通配符匹配 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ dump java.lang.String
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
打印参数,和 linux 里的 echo 命令类似。
|
||||
:::
|
||||
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ echo 'hello'
|
||||
```
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
[`getstatic`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-getstatic)
|
||||
|
||||
### 使用参考
|
||||
|
||||
- 推荐直接使用[ognl](ognl.md)命令,更加灵活。
|
||||
|
||||
通过 getstatic 命令可以方便的查看类的静态属性。使用方法为`getstatic class_name field_name`
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
类似传统的`grep`命令。
|
||||
:::
|
||||
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
USAGE:
|
||||
grep [-A <value>] [-B <value>] [-C <value>] [-h] [-i] [-v] [-n] [-m <value>] [-e] [--trim-end] pattern
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
dump java heap, 类似 jmap 命令的 heap dump 功能。
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### dump 到指定文件
|
||||
### dump 到指定文件
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump /tmp/dump.hprof
|
||||
@@ -16,7 +16,7 @@ Dumping heap to /tmp/dump.hprof...
|
||||
Heap dump file created
|
||||
```
|
||||
|
||||
#### 只 dump live 对象
|
||||
### 只 dump live 对象
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump --live /tmp/dump.hprof
|
||||
@@ -24,7 +24,7 @@ Dumping heap to /tmp/dump.hprof...
|
||||
Heap dump file created
|
||||
```
|
||||
|
||||
### dump 到临时文件
|
||||
## dump 到临时文件
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
[help 指令]的等同于[指令 -help],都是查看具体指令的使用说明。
|
||||
:::
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| -------: | :----------------------------------------- |
|
||||
| 不接参数 | 查询当前 arthas 版本支持的指令以及指令描述 |
|
||||
| [name:] | 查询具体指令的使用说明 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ help
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
历史指令会通过一个名叫 history 的文件持久化,所以 history 指令可以查看当前 arthas 服务器的所有历史命令,而不仅只是当前次会话使用过的命令。
|
||||
:::
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| -------: | :---------------------- |
|
||||
| [c:] | 清空历史指令 |
|
||||
| [n:] | 显示最近执行的 n 条指令 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
#查看最近执行的3条指令
|
||||
|
||||
+23
-23
@@ -2,20 +2,20 @@
|
||||
|
||||
[`Http API`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=case-http-api)
|
||||
|
||||
### 概览
|
||||
## 概览
|
||||
|
||||
Http API
|
||||
提供类似 RESTful 的交互接口,请求和响应均为 JSON 格式的数据。相对于 Telnet/WebConsole 的输出非结构化文本数据,Http
|
||||
API 可以提供结构化的数据,支持更复杂的交互功能,比如特定应用场景的一系列诊断操作。
|
||||
|
||||
#### 访问地址
|
||||
### 访问地址
|
||||
|
||||
Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交请求参数。如 POST
|
||||
`http://127.0.0.1:8563/api` 。
|
||||
|
||||
注意:telnet 服务的 3658 端口与 Chrome 浏览器有兼容性问题,建议使用 http 端口 8563 来访问 http 接口。
|
||||
|
||||
#### 请求数据格式
|
||||
### 请求数据格式
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -39,7 +39,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交
|
||||
|
||||
注意: 不同的 action 使用到参数不同,根据具体的 action 来设置参数。
|
||||
|
||||
#### 请求 Action
|
||||
### 请求 Action
|
||||
|
||||
目前支持的请求 Action 如下:
|
||||
|
||||
@@ -51,7 +51,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交
|
||||
- `join_session` : 加入会话,用于支持多人共享同一个 Arthas 会话
|
||||
- `close_session` : 关闭会话
|
||||
|
||||
#### 响应状态
|
||||
### 响应状态
|
||||
|
||||
响应中的 state 属性表示请求处理状态,取值如下:
|
||||
|
||||
@@ -60,7 +60,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交
|
||||
- `FAILED`:请求处理失败(完成状态),通常附带 message 说明原因;
|
||||
- `REFUSED`:请求被拒绝(完成状态),通常附带 message 说明原因;
|
||||
|
||||
### 一次性命令
|
||||
## 一次性命令
|
||||
|
||||
与执行批处理命令类似,一次性命令以同步方式执行。不需要创建会话,不需要设置`sessionId`选项。
|
||||
|
||||
@@ -147,7 +147,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
- 通过`-n`参数指定较少的执行次数。
|
||||
- 保证命令匹配的方法可以成功命中和 condition-express 编写正确,如果 watch/trace 没有命中就算指定`-n 1`也会挂起等待到执行超时。
|
||||
|
||||
### 会话交互
|
||||
## 会话交互
|
||||
|
||||
由用户创建及管理 Arthas 会话,适用于复杂的交互过程。访问流程如下:
|
||||
|
||||
@@ -158,7 +158,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
- 中断命令执行
|
||||
- 关闭会话
|
||||
|
||||
#### 创建会话
|
||||
### 创建会话
|
||||
|
||||
```bash
|
||||
curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
@@ -180,7 +180,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
|
||||
当前会话 ID 为: `b09f1353-202c-407b-af24-701b744f971e`, 当前消费者 ID 为:`5ae4e5fbab8b4e529ac404f260d4e2d1_1 `。
|
||||
|
||||
#### 加入会话
|
||||
### 加入会话
|
||||
|
||||
指定要加入的会话 ID,服务端将分配一个新的消费者 ID。多个消费者可以接收到同一个会话的命令结果。本接口用于支持多人共享同一个会话或刷新页面后重新拉取会话历史记录。
|
||||
|
||||
@@ -205,7 +205,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
|
||||
新的消费者 ID 为`8f7f6ad7bc2d4cb5aa57a530927a95cc_2 ` 。
|
||||
|
||||
#### 拉取命令结果
|
||||
### 拉取命令结果
|
||||
|
||||
拉取命令结果消息的 action 为`pull_results`。请使用 Http long-polling 方式,定时循环拉取结果消息。
|
||||
消费者的超时时间为 5 分钟,超时后需要调用`join_session`分配新的消费者。每个消费者单独分配一个缓存队列,按顺序拉取命令结果,不会影响到其它消费者。
|
||||
@@ -274,7 +274,7 @@ while true; do curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
}
|
||||
```
|
||||
|
||||
#### 异步执行命令
|
||||
### 异步执行命令
|
||||
|
||||
```bash
|
||||
curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
@@ -396,7 +396,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
watch 命令结果的`value`为 watch-experss 的值,上面命令中为`{params, returnObj, throwExp}`,所以 watch 结果的 value 为一个长度为 3 的数组,每个元素分别对应相应顺序的表达式。
|
||||
请参考"[watch 命令输出 map 对象](#change_watch_value_to_map)"小节。
|
||||
|
||||
#### 中断命令执行
|
||||
### 中断命令执行
|
||||
|
||||
中断会话正在运行的前台 Job(前台任务):
|
||||
|
||||
@@ -419,7 +419,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
}
|
||||
```
|
||||
|
||||
#### 关闭会话
|
||||
### 关闭会话
|
||||
|
||||
指定会话 ID,关闭会话。
|
||||
|
||||
@@ -438,11 +438,11 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
}
|
||||
```
|
||||
|
||||
### 鉴权
|
||||
## 鉴权
|
||||
|
||||
参考: [auth](auth.md)
|
||||
|
||||
### Web UI
|
||||
## Web UI
|
||||
|
||||

|
||||
|
||||
@@ -465,9 +465,9 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
|
||||
<a id="special_command_results"></a>
|
||||
|
||||
### 特殊命令结果
|
||||
## 特殊命令结果
|
||||
|
||||
#### status
|
||||
### status
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -493,7 +493,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
}
|
||||
```
|
||||
|
||||
#### input_status
|
||||
### input_status
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -514,7 +514,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
允许用户中断命令执行,表示当前正在执行命令,用户可以发送`interrupt_job`中断执行。
|
||||
- `DISABLED` : 禁用状态,不能输入命令也不能中断命令。
|
||||
|
||||
#### command
|
||||
### command
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -529,7 +529,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
|
||||
用于交互 UI 回显用户输入的命令,拉取的会话命令消息历史会包含`command`类型的消息,按顺序处理即可。
|
||||
|
||||
#### enhancer
|
||||
### enhancer
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -549,9 +549,9 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
|
||||
`trace/watch/jad/tt`等命令需要对类进行增强,会接收到这个`enhancer`结果。可能出现`enhancer`结果成功,但没有命中方法的情况,客户端可以根据`enhancer`结果提示用户。
|
||||
|
||||
### 案例
|
||||
## 案例
|
||||
|
||||
#### 获取 Java 应用的 Classpath
|
||||
### 获取 Java 应用的 Classpath
|
||||
|
||||
通过 Http api 查询 Java 应用的 System properties,提取`java.class.path`的值。
|
||||
|
||||
@@ -590,7 +590,7 @@ classpath: demo-arthas-spring-boot.jar
|
||||
|
||||
<a id="change_watch_value_to_map"></a>
|
||||
|
||||
#### watch 命令输出 map 对象
|
||||
### watch 命令输出 map 对象
|
||||
|
||||
watch 的结果值由计算`watch-express` ognl 表达式产生,可以通过改变 ognl 表达式来生成想要的值,请参考[OGNL 文档](https://commons.apache.org/proper/commons-ognl/language-guide.html)。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# IDEA Plugin
|
||||
|
||||
#### Arthas-idea(部分命令可视化)
|
||||
## Arthas-idea(部分命令可视化)
|
||||
|
||||
::: tip
|
||||
插件由社区开发者提供。
|
||||
@@ -10,7 +10,7 @@
|
||||
- 使用文档:[https://www.yuque.com/arthas-idea-plugin](https://www.yuque.com/arthas-idea-plugin)
|
||||
- 源码地址: [https://github.com/WangJi92/arthas-idea-plugin](https://github.com/WangJi92/arthas-idea-plugin)
|
||||
|
||||
#### Alibaba Cloud Toolkit 热部署组件(一键 retransform)
|
||||
## Alibaba Cloud Toolkit 热部署组件(一键 retransform)
|
||||
|
||||
::: tip
|
||||
热部署组件支持一键将编辑器中修改的 Java 源码快速编译,并更新到远端应用服务中,免去手动 dump、mc 的过程。此外,也可以一键还原 retransform 的类文件。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 在 Arthas Console 上,反编译出来的源码是带语法高亮的,阅读更方便
|
||||
- 当然,反编译出来的 java 代码可能会存在语法错误,但不影响你进行阅读理解
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :----------------------------------------- |
|
||||
@@ -20,9 +20,9 @@
|
||||
| `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name |
|
||||
| [E] | 开启正则表达式匹配,默认为通配符匹配 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 反编译`java.lang.String`
|
||||
### 反编译`java.lang.String`
|
||||
|
||||
```java
|
||||
$ jad java.lang.String
|
||||
@@ -60,7 +60,7 @@ Location:
|
||||
...
|
||||
```
|
||||
|
||||
#### 反编译时只显示源代码
|
||||
### 反编译时只显示源代码
|
||||
|
||||
默认情况下,反编译结果里会带有`ClassLoader`信息,通过`--source-only`选项,可以只打印源代码。方便和[mc](mc.md)/[retransform](retransform.md)命令结合使用。
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MathGame {
|
||||
...
|
||||
```
|
||||
|
||||
#### 反编译指定的函数
|
||||
### 反编译指定的函数
|
||||
|
||||
```java
|
||||
$ jad demo.MathGame main
|
||||
@@ -105,7 +105,7 @@ Location:
|
||||
}
|
||||
```
|
||||
|
||||
#### 反编译时不显示行号
|
||||
### 反编译时不显示行号
|
||||
|
||||
`--lineNumber` 参数默认值为 true,显示指定为 false 则不打印行号。
|
||||
|
||||
@@ -128,7 +128,7 @@ public static void main(String[] args) throws InterruptedException {
|
||||
}
|
||||
```
|
||||
|
||||
#### 反编译时指定 ClassLoader
|
||||
### 反编译时指定 ClassLoader
|
||||
|
||||
::: tip
|
||||
当有多个 `ClassLoader` 都加载了这个类时,`jad` 命令会输出对应 `ClassLoader` 实例的 `hashcode`,然后你只需要重新执行 `jad` 命令,并使用参数 `-c <hashcode>` 就可以反编译指定 ClassLoader 加载的那个类了;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
查看当前 JVM 信息
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ jvm
|
||||
@@ -110,7 +110,7 @@ RUNTIME
|
||||
Affect(row-cnt:0) cost in 88 ms.
|
||||
```
|
||||
|
||||
### THREAD 相关
|
||||
## THREAD 相关
|
||||
|
||||
- COUNT: JVM 当前活跃的线程数
|
||||
- DAEMON-COUNT: JVM 当前活跃的守护线程数
|
||||
@@ -118,7 +118,7 @@ Affect(row-cnt:0) cost in 88 ms.
|
||||
- STARTED-COUNT: 从 JVM 启动开始总共启动过的线程次数
|
||||
- DEADLOCK-COUNT: JVM 当前死锁的线程数
|
||||
|
||||
### 文件描述符相关
|
||||
## 文件描述符相关
|
||||
|
||||
- MAX-FILE-DESCRIPTOR-COUNT:JVM 进程最大可以打开的文件描述符数
|
||||
- OPEN-FILE-DESCRIPTOR-COUNT:JVM 当前打开的文件描述符数
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Arthas 命令行快捷键
|
||||
# keymap
|
||||
|
||||
[`keymap`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-keymap)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- 任何时候 `tab` 键,会根据当前的输入给出提示
|
||||
- 命令后敲 `-` 或 `--` ,然后按 `tab` 键,可以展示出此命令具体的选项
|
||||
|
||||
#### 自定义快捷键
|
||||
## 自定义快捷键
|
||||
|
||||
在当前用户目录下新建`$USER_HOME/.arthas/conf/inputrc`文件,加入自定义配置。
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
然后把`"\C-h": backward-delete-char`换成`"\C-h": backward-char`,然后重新连接即可。
|
||||
|
||||
#### 后台异步命令相关快捷键
|
||||
## 后台异步命令相关快捷键
|
||||
|
||||
- ctrl + c: 终止当前命令
|
||||
- ctrl + z: 挂起当前命令,后续可以 bg/fg 重新支持此命令,或 kill 掉
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
查看 logger 信息,更新 logger level
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 查看所有 logger 信息
|
||||
### 查看所有 logger 信息
|
||||
|
||||
以下面的`logback.xml`为例:
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
- `APPLICATION` logger 是`RollingFileAppender`,它的 file 是`app.log`
|
||||
- `ASYNC`它的`appenderRef`是`APPLICATION`,即异步输出到文件里
|
||||
|
||||
#### 查看指定名字的 logger 信息
|
||||
### 查看指定名字的 logger 信息
|
||||
|
||||
```bash
|
||||
[arthas@2062]$ logger -n org.springframework.web
|
||||
@@ -96,7 +96,7 @@
|
||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
||||
```
|
||||
|
||||
#### 查看指定 classloader 的 logger 信息
|
||||
### 查看指定 classloader 的 logger 信息
|
||||
|
||||
注意 hashcode 是变化的,需要先查看当前的 ClassLoader 信息,提取对应 ClassLoader 的 hashcode。
|
||||
|
||||
@@ -137,14 +137,14 @@
|
||||
|
||||
`--classLoaderClass` 的值是 ClassLoader 的类名,只有匹配到唯一的 ClassLoader 实例时才能工作,目的是方便输入通用命令,而`-c <hashcode>`是动态变化的。
|
||||
|
||||
#### 更新 logger level
|
||||
### 更新 logger level
|
||||
|
||||
```bash
|
||||
[arthas@2062]$ logger --name ROOT --level debug
|
||||
update logger level success.
|
||||
```
|
||||
|
||||
#### 指定 classloader 更新 logger level
|
||||
### 指定 classloader 更新 logger level
|
||||
|
||||
默认情况下,logger 命令会在 SystemClassloader 下执行,如果应用是传统的`war`应用,或者 spring boot fat jar 启动的应用,那么需要指定 classloader。
|
||||
|
||||
@@ -154,7 +154,7 @@ update logger level success.
|
||||
[arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug
|
||||
```
|
||||
|
||||
#### 查看没有 appender 的 logger 的信息
|
||||
### 查看没有 appender 的 logger 的信息
|
||||
|
||||
默认情况下,`logger`命令只打印有 appender 的 logger 的信息。如果想查看没有`appender`的 logger 的信息,可以加上参数`--include-no-appender`。
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
这个命令可以便捷的查看或监控 Mbean 的属性信息。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| ------------------: | :--------------------------------------------------- |
|
||||
@@ -19,7 +19,7 @@
|
||||
| [n:] | 刷新属性值的次数 |
|
||||
| [E] | 开启正则表达式匹配,默认为通配符匹配。仅对属性名有效 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
列出所有 Mbean 的名称:
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
[`mc-retransform`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=command-mc-retransform)
|
||||
|
||||
## 使用参考
|
||||
|
||||
::: tip
|
||||
Memory Compiler/内存编译器,编译`.java`文件生成`.class`。
|
||||
:::
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
查看 JVM 内存信息。
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ memory
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
服务端是以任务的形式在后台跑任务,植入的代码随着任务的中止而不会被执行,所以任务关闭后,不会对原有性能产生太大影响,而且原则上,任何 Arthas 命令不会引起原有业务逻辑的改变。
|
||||
|
||||
### 监控的维度说明
|
||||
## 监控的维度说明
|
||||
|
||||
| 监控项 | 说明 |
|
||||
| --------: | :------------------------- |
|
||||
@@ -27,7 +27,7 @@
|
||||
| rt | 平均 RT |
|
||||
| fail-rate | 失败率 |
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
方法拥有一个命名参数 `[c:]`,意思是统计周期(cycle of output),拥有一个整型的参数值
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
| `[c:]` | 统计周期,默认值为 120 秒 |
|
||||
| [b] | 在**方法调用之前**计算 condition-express |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ monitor -c 5 demo.MathGame primeFactors
|
||||
@@ -71,7 +71,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 94 ms.
|
||||
2018-12-03 19:07:03 demo.MathGame primeFactors 2 2 0 3182.72 0.00%
|
||||
```
|
||||
|
||||
#### 计算条件表达式过滤统计结果(方法执行完毕之后)
|
||||
### 计算条件表达式过滤统计结果(方法执行完毕之后)
|
||||
|
||||
```bash
|
||||
monitor -c 5 demo.MathGame primeFactors "params[0] <= 2"
|
||||
@@ -98,7 +98,7 @@ Affect(class count: 1 , method count: 1) cost in 19 ms, listenerId: 5
|
||||
2020-09-02 09:42:56 demo.MathGame primeFactors 5 3 2 0.15 40.00%
|
||||
```
|
||||
|
||||
#### 计算条件表达式过滤统计结果(方法执行完毕之前)
|
||||
### 计算条件表达式过滤统计结果(方法执行完毕之前)
|
||||
|
||||
```bash
|
||||
monitor -b -c 5 com.test.testes.MathGame primeFactors "params[0] <= 2"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
从 3.0.5 版本增加
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :--------------------------------------------------------------- |
|
||||
@@ -17,7 +17,7 @@
|
||||
| `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name |
|
||||
| [x] | 结果对象的展开层次,默认值 1 |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
- OGNL 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71)
|
||||
- OGNL 表达式官方指南:[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
| batch-re-transform | true | 是否支持批量对匹配到的类执行 retransform 操作 |
|
||||
| json-format | false | 是否支持 json 化的输出 |
|
||||
| disable-sub-class | false | 是否禁用子类匹配,默认在匹配目标类的时候会默认匹配到其子类,如果想精确匹配,可以关闭此开关 |
|
||||
| support-default-method | true | 是否支持匹配到 default method, 默认会查找 interface,匹配里面的 default method。参考 [#1105](https://github.com/alibaba/arthas/issues/1105) |
|
||||
| support-default-method | true | 是否支持匹配到 default method, 默认会查找 interface,匹配里面的 default method。参考 [#1105](https://github.com/alibaba/arthas/issues/1105) |
|
||||
| save-result | false | 是否打开执行结果存日志功能,打开之后所有命令的运行结果都将保存到`~/logs/arthas-cache/result.log`中 |
|
||||
| job-timeout | 1d | 异步后台任务的默认超时时间,超过这个时间,任务自动停止; 比如设置 1d, 2h, 3m, 25s,分别代表天、小时、分、秒 |
|
||||
| job-timeout | 1d | 异步后台任务的默认超时时间,超过这个时间,任务自动停止;比如设置 1d, 2h, 3m, 25s,分别代表天、小时、分、秒 |
|
||||
| print-parent-fields | true | 是否打印在 parent class 里的 filed |
|
||||
| verbose | false | 是否打 印更多详细信息 |
|
||||
| verbose | false | 是否打印更多详细信息 |
|
||||
| strict | true | 是否启用 strict 模式 |
|
||||
|
||||
### 查看所有的 options
|
||||
## 查看所有的 options
|
||||
|
||||
```bash
|
||||
$ options
|
||||
@@ -64,7 +64,7 @@ $ options
|
||||
false`
|
||||
```
|
||||
|
||||
### 获取 option 的值
|
||||
## 获取 option 的值
|
||||
|
||||
```
|
||||
$ options json-format
|
||||
@@ -79,7 +79,7 @@ $ options json-format
|
||||
默认情况下`json-format`为 false,如果希望`watch`/`tt`等命令结果以 json 格式输出,则可以设置`json-format`为 true。
|
||||
:::
|
||||
|
||||
### 设置指定的 option
|
||||
## 设置指定的 option
|
||||
|
||||
例如,想打开执行结果存日志功能,输入如下命令即可:
|
||||
|
||||
@@ -90,7 +90,7 @@ $ options save-result true
|
||||
save-result false true
|
||||
```
|
||||
|
||||
### 打开 unsafe 开关,支持 jdk package 下的类
|
||||
## 打开 unsafe 开关,支持 jdk package 下的类
|
||||
|
||||
默认情况下,`watch`/`trace`/`tt`/`trace`/`monitor`等命令不支持`java.*` package 下的类。可以设置`unsafe`为 true,则可以增强。
|
||||
|
||||
@@ -107,7 +107,7 @@ Press Q or Ctrl+C to abort.
|
||||
Affect(class count: 1 , method count: 1) cost in 61 ms, listenerId: 1
|
||||
```
|
||||
|
||||
### 关闭 strict 模式,允许在 ognl 表达式里设置对象属性
|
||||
## 关闭 strict 模式,允许在 ognl 表达式里设置对象属性
|
||||
|
||||
::: tip
|
||||
since 3.6.0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
查看当前 JVM 的 Perf Counter 信息
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ perfcounter
|
||||
@@ -34,7 +34,7 @@ $ perfcounter -d
|
||||
java.cls.unloadedClasses Monotonic Events 0
|
||||
```
|
||||
|
||||
### jdk9 以上的应用
|
||||
## jdk9 以上的应用
|
||||
|
||||
如果没有打印出信息,应用在启动时,加下面的参数:
|
||||
|
||||
|
||||
+17
-17
@@ -10,7 +10,7 @@
|
||||
|
||||
`profiler` 命令基本运行结构是 `profiler action [actionArg]`
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| ----------: | :-------------------------------------------------------------- |
|
||||
@@ -21,7 +21,7 @@
|
||||
| [d:] | 运行评测指定秒 |
|
||||
| [e:] | 要跟踪哪个事件(cpu, alloc, lock, cache-misses 等),默认是 cpu |
|
||||
|
||||
### 启动 profiler
|
||||
## 启动 profiler
|
||||
|
||||
```
|
||||
$ profiler start
|
||||
@@ -32,14 +32,14 @@ Started [cpu] profiling
|
||||
默认情况下,生成的是 cpu 的火焰图,即 event 为`cpu`。可以用`--event`参数来指定。
|
||||
:::
|
||||
|
||||
### 获取已采集的 sample 的数量
|
||||
## 获取已采集的 sample 的数量
|
||||
|
||||
```
|
||||
$ profiler getSamples
|
||||
23
|
||||
```
|
||||
|
||||
### 查看 profiler 状态
|
||||
## 查看 profiler 状态
|
||||
|
||||
```bash
|
||||
$ profiler status
|
||||
@@ -48,9 +48,9 @@ $ profiler status
|
||||
|
||||
可以查看当前 profiler 在采样哪种`event`和采样时间。
|
||||
|
||||
### 停止 profiler
|
||||
## 停止 profiler
|
||||
|
||||
#### 生成 html 格式结果
|
||||
### 生成 html 格式结果
|
||||
|
||||
默认情况下,结果文件是`html`格式,也可以用`--format`参数指定:
|
||||
|
||||
@@ -62,7 +62,7 @@ OK
|
||||
|
||||
或者在`--file`参数里用文件名指名格式。比如`--file /tmp/result.html` 。
|
||||
|
||||
### 通过浏览器查看 arthas-output 下面的 profiler 结果
|
||||
## 通过浏览器查看 arthas-output 下面的 profiler 结果
|
||||
|
||||
默认情况下,arthas 使用 3658 端口,则可以打开: [http://localhost:3658/arthas-output/](http://localhost:3658/arthas-output/) 查看到`arthas-output`目录下面的 profiler 结果:
|
||||
|
||||
@@ -76,7 +76,7 @@ OK
|
||||
如果是 chrome 浏览器,可能需要多次刷新。
|
||||
:::
|
||||
|
||||
### profiler 支持的 events
|
||||
## profiler 支持的 events
|
||||
|
||||
在不同的平台,不同的 OS 下面,支持的 events 各有不同。比如在 macos 下面:
|
||||
|
||||
@@ -125,7 +125,7 @@ Perf events:
|
||||
$ profiler start --event alloc
|
||||
```
|
||||
|
||||
### 恢复采样
|
||||
## 恢复采样
|
||||
|
||||
```bash
|
||||
$ profiler resume
|
||||
@@ -136,7 +136,7 @@ Started [cpu] profiling
|
||||
|
||||
通过执行`profiler getSamples`可以查看 samples 的数量来验证。
|
||||
|
||||
### 使用`execute`来执行复杂的命令
|
||||
## 使用`execute`来执行复杂的命令
|
||||
|
||||
比如开始采样:
|
||||
|
||||
@@ -152,14 +152,14 @@ profiler execute 'stop,file=/tmp/result.html'
|
||||
|
||||
具体的格式参考: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v2.5/src/arguments.cpp#L50)
|
||||
|
||||
### 查看所有支持的 action
|
||||
## 查看所有支持的 action
|
||||
|
||||
```bash
|
||||
$ profiler actions
|
||||
Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status]
|
||||
```
|
||||
|
||||
### 查看版本
|
||||
## 查看版本
|
||||
|
||||
```bash
|
||||
$ profiler version
|
||||
@@ -167,7 +167,7 @@ Async-profiler 1.6 built on Sep 9 2019
|
||||
Copyright 2019 Andrei Pangin
|
||||
```
|
||||
|
||||
### 配置 framebuf 参数
|
||||
## 配置 framebuf 参数
|
||||
|
||||
> 如果遇到生成的火焰图有 `[frame_buffer_overflow]`,则需要增大 framebuf(默认值是 1'000'000),可以显式配置,比如:
|
||||
|
||||
@@ -175,7 +175,7 @@ Copyright 2019 Andrei Pangin
|
||||
profiler start --framebuf 5000000
|
||||
```
|
||||
|
||||
### 配置 include/exclude 来过滤数据
|
||||
## 配置 include/exclude 来过滤数据
|
||||
|
||||
如果应用比较复杂,生成的内容很多,想只关注部分数据,可以通过 include/exclude 来过滤。比如
|
||||
|
||||
@@ -185,7 +185,7 @@ profiler start --include 'java/*' --include 'demo/*' --exclude '*Unsafe.park*'
|
||||
|
||||
> include/exclude 都支持设置多个值 ,但是需要配置在命令行的最后。
|
||||
|
||||
### 指定执行时间
|
||||
## 指定执行时间
|
||||
|
||||
比如,希望 profiler 执行 300 秒自动结束,可以用 `-d`/`--duration` 参数指定:
|
||||
|
||||
@@ -193,7 +193,7 @@ profiler start --include 'java/*' --include 'demo/*' --exclude '*Unsafe.park*'
|
||||
profiler start --duration 300
|
||||
```
|
||||
|
||||
### 生成 jfr 格式结果
|
||||
## 生成 jfr 格式结果
|
||||
|
||||
> 注意,jfr 只支持在 `start`时配置。如果是在`stop`时指定,则不会生效。
|
||||
|
||||
@@ -211,6 +211,6 @@ profiler start --file /tmp/test.jfr
|
||||
- JDK Mission Control : https://github.com/openjdk/jmc
|
||||
- JProfiler : https://github.com/alibaba/arthas/issues/1416
|
||||
|
||||
### 生成的火焰图里的 unknown
|
||||
## 生成的火焰图里的 unknown
|
||||
|
||||
- https://github.com/jvm-profiling-tools/async-profiler/discussions/409
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
返回当前的工作目录,和 linux 命令类似
|
||||
:::
|
||||
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ pwd
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
参考:[Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)
|
||||
|
||||
### 常见问题
|
||||
## 常见问题
|
||||
|
||||
::: tip
|
||||
推荐使用 [retransform](retransform.md) 命令
|
||||
@@ -37,14 +37,14 @@
|
||||
原因是 jdk 本身 redefine 和 Retransform 是不同的机制,同时使用两种机制来更新字节码,只有最后修改的会生效。
|
||||
:::
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :----------------------------------------- |
|
||||
| [c:] | ClassLoader 的 hashcode |
|
||||
| `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
redefine /tmp/Test.class
|
||||
@@ -52,7 +52,7 @@
|
||||
redefine --classLoaderClass sun.misc.Launcher$AppClassLoader /tmp/Test.class /tmp/Test\$Inner.class
|
||||
```
|
||||
|
||||
### 结合 jad/mc 命令使用
|
||||
## 结合 jad/mc 命令使用
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
@@ -66,7 +66,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class
|
||||
- mc 命令来内存编译修改过的代码
|
||||
- 用 redefine 命令加载新的字节码
|
||||
|
||||
### 上传 .class 文件到服务器的技巧
|
||||
## 上传 .class 文件到服务器的技巧
|
||||
|
||||
使用`mc`命令来编译`jad`的反编译的代码有可能失败。可以在本地修改代码,编译好后再上传到服务器上。有的服务器不允许直接上传文件,可以使用`base64`命令来绕过。
|
||||
|
||||
@@ -86,7 +86,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class
|
||||
|
||||
4. 用 md5 命令计算哈希值,校验是否一致
|
||||
|
||||
### redefine 的限制
|
||||
## redefine 的限制
|
||||
|
||||
- 不允许新增加 field/method
|
||||
- 正在跑的函数,没有退出不能生效,比如下面新增加的`System.out.println`,只有`run()`函数里的会生效
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# reset 命令
|
||||
# reset
|
||||
|
||||
[`reset`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-reset)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
重置增强类,将被 Arthas 增强过的类全部还原,Arthas 服务端`stop`时会重置所有增强过的类
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ reset -h
|
||||
@@ -27,7 +27,7 @@ $ reset -h
|
||||
<class-pattern> Path and classname of Pattern Matching
|
||||
```
|
||||
|
||||
### 还原指定类
|
||||
## 还原指定类
|
||||
|
||||
```
|
||||
$ trace Test test
|
||||
@@ -43,7 +43,7 @@ $ reset Test
|
||||
Affect(class-cnt:1 , method-cnt:0) cost in 11 ms.
|
||||
```
|
||||
|
||||
### 还原所有类
|
||||
## 还原所有类
|
||||
|
||||
```
|
||||
$ trace Test test
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
参考:[Instrumentation#retransformClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses-java.lang.Class...-)
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
retransform /tmp/Test.class
|
||||
@@ -20,7 +20,7 @@
|
||||
retransform --classLoaderClass 'sun.misc.Launcher$AppClassLoader' /tmp/Test.class
|
||||
```
|
||||
|
||||
### retransform 指定的 .class 文件
|
||||
## retransform 指定的 .class 文件
|
||||
|
||||
```bash
|
||||
$ retransform /tmp/MathGame.class
|
||||
@@ -34,7 +34,7 @@ demo.MathGame
|
||||
如果多次执行 retransform 加载同一个 class 文件,则会有多条 retransform entry.
|
||||
:::
|
||||
|
||||
### 查看 retransform entry
|
||||
## 查看 retransform entry
|
||||
|
||||
```bash
|
||||
$ retransform -l
|
||||
@@ -44,7 +44,7 @@ Id ClassName TransformCount LoaderHash LoaderClassName
|
||||
|
||||
- TransformCount 统计在 ClassFileTransformer#transform 函数里尝试返回 entry 对应的 .class 文件的次数,但并不表明 transform 一定成功。
|
||||
|
||||
### 删除指定 retransform entry
|
||||
## 删除指定 retransform entry
|
||||
|
||||
需要指定 id:
|
||||
|
||||
@@ -52,13 +52,13 @@ Id ClassName TransformCount LoaderHash LoaderClassName
|
||||
retransform -d 1
|
||||
```
|
||||
|
||||
### 删除所有 retransform entry
|
||||
## 删除所有 retransform entry
|
||||
|
||||
```bash
|
||||
retransform --deleteAll
|
||||
```
|
||||
|
||||
### 显式触发 retransform
|
||||
## 显式触发 retransform
|
||||
|
||||
```bash
|
||||
$ retransform --classPattern demo.MathGame
|
||||
@@ -68,7 +68,7 @@ demo.MathGame
|
||||
|
||||
> 注意:对于同一个类,当存在多个 retransform entry 时,如果显式触发 retransform ,则最后添加的 entry 生效(id 最大的)。
|
||||
|
||||
### 消除 retransform 的影响
|
||||
## 消除 retransform 的影响
|
||||
|
||||
如果对某个类执行 retransform 之后,想消除影响,则需要:
|
||||
|
||||
@@ -79,7 +79,7 @@ demo.MathGame
|
||||
如果不清除掉所有的 retransform entry,并重新触发 retransform ,则 arthas stop 时,retransform 过的类仍然生效。
|
||||
:::
|
||||
|
||||
### 结合 jad/mc 命令使用
|
||||
## 结合 jad/mc 命令使用
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
@@ -93,7 +93,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class
|
||||
- mc 命令来内存编译修改过的代码
|
||||
- 用 retransform 命令加载新的字节码
|
||||
|
||||
### 上传 .class 文件到服务器的技巧
|
||||
## 上传 .class 文件到服务器的技巧
|
||||
|
||||
使用`mc`命令来编译`jad`的反编译的代码有可能失败。可以在本地修改代码,编译好后再上传到服务器上。有的服务器不允许直接上传文件,可以使用`base64`命令来绕过。
|
||||
|
||||
@@ -113,7 +113,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class
|
||||
|
||||
4. 用 md5 命令计算哈希值,校验是否一致
|
||||
|
||||
### retransform 的限制
|
||||
## retransform 的限制
|
||||
|
||||
- 不允许新增加 field/method
|
||||
- 正在跑的函数,没有退出不能生效,比如下面新增加的`System.out.println`,只有`run()`函数里的会生效
|
||||
|
||||
@@ -22,7 +22,7 @@ Affect(row-cnt:1) cost in 3 ms.
|
||||
|
||||
结果会异步保存在:`{user.home}/logs/arthas-cache/result.log`,请定期进行清理,以免占据磁盘空间
|
||||
|
||||
### 使用新版本 Arthas 的异步后台任务将结果存日志文件
|
||||
## 使用新版本 Arthas 的异步后台任务将结果存日志文件
|
||||
|
||||
```bash
|
||||
$ trace Test t >> &
|
||||
|
||||
+1
-3
@@ -10,8 +10,6 @@
|
||||
|
||||
## 参数说明
|
||||
|
||||
### 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| _class-pattern_ | 类名表达式匹配 |
|
||||
@@ -32,7 +30,7 @@ class-pattern 支持全限定名,如 com.taobao.test.AAA,也支持 com/taoba
|
||||
sc 默认开启了子类匹配功能,也就是说所有当前类的子类也会被搜索出来,想要精确的匹配,请打开`options disable-sub-class true`开关
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
- 模糊搜索
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
如果使用了 staturl 做统计,会追加显示 statUrl 地址。
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ session
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
|
||||
`sm` 命令只能看到由当前类所声明 (declaring) 的方法,父类则无法看到。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| --------------------: | :------------------------------------------- |
|
||||
@@ -22,7 +22,7 @@
|
||||
| `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name |
|
||||
| `[n:]` | 具有详细信息的匹配类的最大数量(默认为 100) |
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```bash
|
||||
$ sm java.lang.String
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
一键创建包含 Arthas Spring Boot Starter 的工程:<a href="https://start.aliyun.com/bootstrap.html/#!dependencies=arthas" target="_blank">点击</a>
|
||||
:::
|
||||
|
||||
### 配置属性
|
||||
## 配置属性
|
||||
|
||||
比如,通过配置 tunnel server 实现远程管理:
|
||||
|
||||
@@ -39,7 +39,7 @@ arthas.tunnel-server=ws://47.75.156.201:7777/ws
|
||||
|
||||
参考:[Arthas Properties](arthas-properties.md)
|
||||
|
||||
### 查看 Endpoint 信息
|
||||
## 查看 Endpoint 信息
|
||||
|
||||
::: tip
|
||||
需要配置 spring boot 暴露 endpoint:[参考](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints)
|
||||
@@ -58,7 +58,7 @@ http://localhost:8080/actuator/arthas
|
||||
}
|
||||
```
|
||||
|
||||
### 非 spring boot 应用使用方式
|
||||
## 非 spring boot 应用使用方式
|
||||
|
||||
非 Spring Boot 应用,可以通过下面的方式来使用:
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
很多时候我们都知道一个方法被执行,但这个方法被执行的路径非常多,或者你根本就不知道这个方法是从那里被执行了,此时你需要的是 stack 命令。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| ------------------: | :----------------------------------- |
|
||||
@@ -27,13 +27,13 @@
|
||||
- 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71)
|
||||
- OGNL 表达式官网:[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
|
||||
|
||||
### 使用例子
|
||||
## 使用例子
|
||||
|
||||
#### 启动 Demo
|
||||
### 启动 Demo
|
||||
|
||||
启动[快速入门](quick-start.md)里的`math-game`。
|
||||
|
||||
#### stack
|
||||
### stack
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors
|
||||
@@ -44,7 +44,7 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
at demo.MathGame.main(MathGame.java:16)
|
||||
```
|
||||
|
||||
#### 据条件表达式来过滤
|
||||
### 据条件表达式来过滤
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors 'params[0]<0' -n 2
|
||||
@@ -61,7 +61,7 @@ ts=2018-12-04 01:34:30;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
Command execution times exceed limit: 2, so command will exit. You can set it with -n option.
|
||||
```
|
||||
|
||||
#### 据执行时间来过滤
|
||||
### 据执行时间来过滤
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors '#cost>5'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Stop
|
||||
# stop
|
||||
|
||||
关闭 Arthas 服务端,所有 Arthas 客户端全部退出。
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
查看当前 JVM 的环境属性(`System Environment Variables`)
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
USAGE:
|
||||
@@ -27,7 +27,7 @@
|
||||
<env-name> env name
|
||||
```
|
||||
|
||||
#### 查看所有环境变量
|
||||
### 查看所有环境变量
|
||||
|
||||
```
|
||||
$ sysenv
|
||||
@@ -65,7 +65,7 @@ $ sysenv
|
||||
AUTOJUMP_ERROR_PATH /Users/admin/Library/autojump/errors.log
|
||||
```
|
||||
|
||||
#### 查看单个环境变量
|
||||
### 查看单个环境变量
|
||||
|
||||
::: tip
|
||||
支持通过`TAB`键自动补全
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
查看当前 JVM 的系统属性(`System Property`)
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
USAGE:
|
||||
@@ -29,7 +29,7 @@
|
||||
<property-value> property value
|
||||
```
|
||||
|
||||
#### 查看所有属性
|
||||
### 查看所有属性
|
||||
|
||||
```
|
||||
$ sysprop
|
||||
@@ -104,7 +104,7 @@ $ sysprop
|
||||
sun.cpu.isalist
|
||||
```
|
||||
|
||||
#### 查看单个属性
|
||||
### 查看单个属性
|
||||
|
||||
::: tip
|
||||
支持通过`TAB`键自动补全
|
||||
@@ -115,7 +115,7 @@ $ sysprop java.version
|
||||
java.version=1.8.0_51
|
||||
```
|
||||
|
||||
#### 修改单个属性
|
||||
### 修改单个属性
|
||||
|
||||
```
|
||||
$ sysprop user.country
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
tee 指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
|
||||
:::
|
||||
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
USAGE:
|
||||
tee [-a] [-h] [file]
|
||||
|
||||
+11
-11
@@ -6,7 +6,7 @@
|
||||
查看当前线程信息,查看线程的堆栈
|
||||
:::
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| ------------: | :------------------------------------------------------ |
|
||||
@@ -16,11 +16,11 @@
|
||||
| [i `<value>`] | 指定 cpu 使用率统计的采样间隔,单位为毫秒,默认值为 200 |
|
||||
| [--all] | 显示所有匹配的线程 |
|
||||
|
||||
### cpu 使用率是如何统计出来的?
|
||||
## cpu 使用率是如何统计出来的?
|
||||
|
||||
这里的 cpu 使用率与 linux 命令`top -H -p <pid>` 的线程`%CPU`类似,一段采样间隔时间内,当前 JVM 里各个线程的增量 cpu 时间与采样间隔时间的比例。
|
||||
|
||||
#### 工作原理说明:
|
||||
### 工作原理说明:
|
||||
|
||||
- 首先第一次采样,获取所有线程的 CPU 时间(调用的是`java.lang.management.ThreadMXBean#getThreadCpuTime()`及`sun.management.HotspotThreadMBean.getInternalThreadCpuTimes()`接口)
|
||||
- 然后睡眠等待一个间隔时间(默认为 200ms,可以通过`-i`指定间隔时间)
|
||||
@@ -35,9 +35,9 @@
|
||||
另外一种查看 Java 进程的线程 cpu 使用率方法:可以使用[`show-busy-java-threads`](https://github.com/oldratlee/useful-scripts/blob/dev-2.x/docs/java.md#-show-busy-java-threads)这个脚本。
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 支持一键展示当前最忙的前 N 个线程并打印堆栈:
|
||||
### 支持一键展示当前最忙的前 N 个线程并打印堆栈:
|
||||
|
||||
```shell
|
||||
$ thread -n 3
|
||||
@@ -73,7 +73,7 @@ $ thread -n 3
|
||||
注意:线程栈为第二采样结束时获取,不能表明采样间隔时间内该线程都是在处理相同的任务。建议间隔时间不要太长,可能间隔时间越大越不准确。
|
||||
可以根据具体情况尝试指定不同的间隔时间,观察输出结果。
|
||||
|
||||
#### 当没有参数时,显示第一页线程的信息
|
||||
### 当没有参数时,显示第一页线程的信息
|
||||
|
||||
默认按照 CPU 增量时间降序排列,只显示第一页数据。
|
||||
|
||||
@@ -99,11 +99,11 @@ ID NAME GROUP PRIORITY STATE %CPU
|
||||
17 arthas-NettyWebsocketTtyBootst system 5 RUNNABLE 0.0 0.000 0:0.001 false true
|
||||
```
|
||||
|
||||
#### thread --all, 显示所有匹配的线程
|
||||
### thread --all, 显示所有匹配的线程
|
||||
|
||||
显示所有匹配线程信息,有时需要获取全部 JVM 的线程数据进行分析。
|
||||
|
||||
#### thread id, 显示指定线程的运行堆栈
|
||||
### thread id, 显示指定线程的运行堆栈
|
||||
|
||||
```shell
|
||||
$ thread 1
|
||||
@@ -117,7 +117,7 @@ $ thread 1
|
||||
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
|
||||
```
|
||||
|
||||
#### thread -b, 找出当前阻塞其他线程的线程
|
||||
### thread -b, 找出当前阻塞其他线程的线程
|
||||
|
||||
有时候我们发现应用卡住了, 通常是由于某个线程拿住了某个锁, 并且其他线程都在等待这把锁造成的。 为了排查这类问题, arthas 提供了`thread -b`, 一键找出那个罪魁祸首。
|
||||
|
||||
@@ -164,7 +164,7 @@ $ thread -b
|
||||
注意, 目前只支持找出 synchronized 关键字阻塞住的线程, 如果是`java.util.concurrent.Lock`, 目前还不支持。
|
||||
:::
|
||||
|
||||
#### thread -i, 指定采样时间间隔
|
||||
### thread -i, 指定采样时间间隔
|
||||
|
||||
- `thread -i 1000` : 统计最近 1000ms 内的线程 CPU 时间。
|
||||
|
||||
@@ -191,7 +191,7 @@ $ thread -n 3 -i 1000
|
||||
...
|
||||
```
|
||||
|
||||
#### thread --state ,查看指定状态的线程
|
||||
### thread --state ,查看指定状态的线程
|
||||
|
||||
```bash
|
||||
[arthas@28114]$ thread --state WAITING
|
||||
|
||||
+13
-13
@@ -8,7 +8,7 @@
|
||||
|
||||
`trace` 命令能主动搜索 `class-pattern`/`method-pattern` 对应的方法调用路径,渲染和统计整个调用链路上的所有性能开销和追踪调用链路。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
| 参数名称 | 参数说明 |
|
||||
| ------------------: | :----------------------------------- |
|
||||
@@ -34,7 +34,7 @@
|
||||
watch/stack/trace 这个三个命令都支持`#cost`
|
||||
:::
|
||||
|
||||
### 注意事项
|
||||
## 注意事项
|
||||
|
||||
- `trace` 能方便的帮助你定位和发现因 RT 高而导致的性能问题缺陷,但其每次只能跟踪一级方法的调用链路。
|
||||
|
||||
@@ -44,13 +44,13 @@ watch/stack/trace 这个三个命令都支持`#cost`
|
||||
|
||||
- 目前不支持 `trace java.lang.Thread getName`,参考 issue: [#1610](https://github.com/alibaba/arthas/issues/1610) ,考虑到不是非常必要场景,且修复有一定难度,因此当前暂不修复
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 启动 Demo
|
||||
### 启动 Demo
|
||||
|
||||
启动[快速入门](quick-start.md)里的`math-game`。
|
||||
|
||||
#### trace 函数
|
||||
### trace 函数
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run
|
||||
@@ -69,7 +69,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 28 ms.
|
||||
结果里的 `#24`,表示在 run 函数里,在源文件的第`24`行调用了`primeFactors()`函数。
|
||||
:::
|
||||
|
||||
#### trace 次数限制
|
||||
### trace 次数限制
|
||||
|
||||
如果方法调用的次数很多,那么可以用`-n`参数指定捕捉结果的次数。比如下面的例子里,捕捉到一次调用就退出命令。
|
||||
|
||||
@@ -85,7 +85,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 20 ms.
|
||||
Command execution times exceed limit: 1, so command will exit. You can set it with -n option.
|
||||
```
|
||||
|
||||
#### 包含 jdk 的函数
|
||||
### 包含 jdk 的函数
|
||||
|
||||
- `--skipJDKMethod <value> ` skip jdk method trace, default value true.
|
||||
|
||||
@@ -120,7 +120,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 60 ms.
|
||||
`---[0.076457ms] java.io.PrintStream:println() #28
|
||||
```
|
||||
|
||||
#### 据调用耗时过滤
|
||||
### 据调用耗时过滤
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run '#cost > 10'
|
||||
@@ -142,7 +142,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 41 ms.
|
||||
- [0,0,0ms,11]xxx:yyy() [throws Exception],对该方法中相同的方法调用进行了合并,`0,0,0ms,11` 表示方法调用耗时,`min,max,total,count`;`throws Exception` 表明该方法调用中存在异常返回
|
||||
- 这里存在一个统计不准确的问题,就是所有方法耗时加起来可能会小于该监测方法的总耗时,这个是由于 Arthas 本身的逻辑会有一定的耗时
|
||||
|
||||
#### trace 多个类或者多个函数
|
||||
### trace 多个类或者多个函数
|
||||
|
||||
trace 命令只会 trace 匹配到的函数里的子调用,并不会向下 trace 多层。因为 trace 是代价比较贵的,多层 trace 可能会导致最终要 trace 的类和函数非常多。
|
||||
|
||||
@@ -152,7 +152,7 @@ trace 命令只会 trace 匹配到的函数里的子调用,并不会向下 tra
|
||||
trace -E com.test.ClassA|org.test.ClassB method1|method2|method3
|
||||
```
|
||||
|
||||
#### 排除掉指定的类
|
||||
### 排除掉指定的类
|
||||
|
||||
使用 `--exclude-class-pattern` 参数可以排除掉指定的类,比如:
|
||||
|
||||
@@ -160,7 +160,7 @@ trace -E com.test.ClassA|org.test.ClassB method1|method2|method3
|
||||
trace javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter
|
||||
```
|
||||
|
||||
### 动态 trace
|
||||
## 动态 trace
|
||||
|
||||
::: tip
|
||||
3.3.0 版本后支持。
|
||||
@@ -210,7 +210,7 @@ Affect(class count: 1 , method count: 1) cost in 34 ms, listenerId: 1
|
||||
|
||||
通过指定`listenerId`的方式动态 trace,可以不断深入。另外 `watch`/`tt`/`monitor`等命令也支持类似的功能。
|
||||
|
||||
### trace 结果时间不准确问题
|
||||
## trace 结果时间不准确问题
|
||||
|
||||
比如下面的结果里:`0.705196 > (0.152743 + 0.145825)`
|
||||
|
||||
@@ -248,7 +248,7 @@ Affect(class count: 1 , method count: 1) cost in 66 ms, listenerId: 1
|
||||
|
||||
3. 在代码执行过程中,JVM 可能出现停顿,比如 GC,进入同步块等。
|
||||
|
||||
#### 使用 -v 参数打印更多信息
|
||||
### 使用 -v 参数打印更多信息
|
||||
|
||||
::: tip
|
||||
watch/trace/monitor/stack/tt 命令都支持 `-v` 参数
|
||||
|
||||
+7
-7
@@ -12,13 +12,13 @@
|
||||
|
||||
于是乎,TimeTunnel 命令就诞生了。
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 启动 Demo
|
||||
### 启动 Demo
|
||||
|
||||
启动[快速入门](quick-start.md)里的`math-game`。
|
||||
|
||||
#### 记录调用
|
||||
### 记录调用
|
||||
|
||||
对于一个最基本的使用来说,就是记录下当前方法的每次调用环境现场。
|
||||
|
||||
@@ -85,7 +85,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 66 ms.
|
||||
|
||||
前边看到了很多条件表达式中,都使用了 `params[0]`,有关这个变量的介绍,请参考[表达式核心变量](advice-class.md)
|
||||
|
||||
#### 检索调用记录
|
||||
### 检索调用记录
|
||||
|
||||
当你用 `tt` 记录了一大片的时间片段之后,你希望能从中筛选出自己需要的时间片段,这个时候你就需要对现有记录进行检索。
|
||||
|
||||
@@ -123,7 +123,7 @@ Affect(row-cnt:6) cost in 607 ms.
|
||||
|
||||
你需要一个 `-s` 参数。<span style="color:red;">同样的,搜索表达式的核心对象依旧是 `Advice` 对象。</span>
|
||||
|
||||
#### 查看调用信息
|
||||
### 查看调用信息
|
||||
|
||||
对于具体一个时间片的信息而言,你可以通过 `-i` 参数后边跟着对应的 `INDEX` 编号查看到他的详细信息。
|
||||
|
||||
@@ -146,7 +146,7 @@ $ tt -i 1003
|
||||
Affect(row-cnt:1) cost in 11 ms.
|
||||
```
|
||||
|
||||
#### 重做一次调用
|
||||
### 重做一次调用
|
||||
|
||||
当你稍稍做了一些调整之后,你可能需要前端系统重新触发一次你的调用,此时得求爷爷告奶奶的需要前端配合联调的同学再次发起一次调用。而有些场景下,这个调用不是这么好触发的。
|
||||
|
||||
@@ -176,7 +176,7 @@ Affect(row-cnt:1) cost in 14 ms.
|
||||
|
||||
你会发现结果虽然一样,但调用的路径发生了变化,由原来的程序发起变成了 Arthas 自己的内部线程发起的调用了。
|
||||
|
||||
#### 观察表达式
|
||||
### 观察表达式
|
||||
|
||||
`-w, --watch-express` 观察时空隧道使用`ognl` 表达式
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 1: [Web Console](web-console.md)
|
||||
- 2: [Arthas Spring Boot Starter](spring-boot-starter.md)
|
||||
|
||||
### 下载部署 arthas tunnel server
|
||||
## 下载部署 arthas tunnel server
|
||||
|
||||
[https://github.com/alibaba/arthas/releases](https://github.com/alibaba/arthas/releases)
|
||||
|
||||
@@ -37,7 +37,7 @@ java -jar arthas-tunnel-server.jar
|
||||
Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2
|
||||
```
|
||||
|
||||
### 启动 arthas 时连接到 tunnel server
|
||||
## 启动 arthas 时连接到 tunnel server
|
||||
|
||||
在启动 arthas,可以传递`--tunnel-server`参数,比如:
|
||||
|
||||
@@ -87,7 +87,7 @@ id URJZ5L48RPBR2ALI5K4V
|
||||
|
||||

|
||||
|
||||
### 最佳实践
|
||||
## 最佳实践
|
||||
|
||||
::: tip
|
||||
注意,agentId 要保持唯一,否则会在 tunnel server 上冲突,不能正常工作。
|
||||
@@ -103,7 +103,7 @@ Tunnel server 会以`_`做分隔符,提取出`appName`,方便按应用进行
|
||||
另外,也可以在解压的 arthas 目录下的 `arthas.properties`,或者在 spring boot 应用的`application.properties`里配置`appName`。
|
||||
:::
|
||||
|
||||
### Tunnel Server 的管理页面
|
||||
## Tunnel Server 的管理页面
|
||||
|
||||
::: tip
|
||||
需要在 spring boot 的`application.properties`里配置 `arthas.enable-detail-pages=true`
|
||||
@@ -147,7 +147,7 @@ id test_PE3LZO9NA9ENJYTPGL9L
|
||||
|
||||

|
||||
|
||||
### 安全和权限管理
|
||||
## 安全和权限管理
|
||||
|
||||
::: tip
|
||||
**强烈建议不要把 tunnel server 直接暴露到公网上。**
|
||||
@@ -158,13 +158,13 @@ id test_PE3LZO9NA9ENJYTPGL9L
|
||||
1. 用户需要自行开发,对 app name 鉴权。
|
||||
2. 如果开放管理页面,需要增加安全措施。
|
||||
|
||||
### 集群方式管理
|
||||
## 集群方式管理
|
||||
|
||||
如果希望部署多台 tunnel server,可以通过 nginx 做转发,redis 来保存 agent 信息。
|
||||
|
||||
- nginx 需要配置 sticky session,保证用户 web socket 连接到同一个后端 tunnel server 上。简单的配置方式是用`ip_hash`。
|
||||
|
||||
### Arthas tunnel server 的工作原理
|
||||
## Arthas tunnel server 的工作原理
|
||||
|
||||
```
|
||||
browser <-> arthas tunnel server <-> arthas tunnel client <-> arthas agent
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
输出当前目标 Java 进程所加载的 Arthas 版本号
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
```
|
||||
$ version
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
查看,更新 VM 诊断相关的参数
|
||||
:::
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 查看所有的 option
|
||||
### 查看所有的 option
|
||||
|
||||
```bash
|
||||
[arthas@56963]$ vmoption
|
||||
@@ -38,7 +38,7 @@
|
||||
PrintConcurrentLocks false DEFAULT true
|
||||
```
|
||||
|
||||
#### 查看指定的 option
|
||||
### 查看指定的 option
|
||||
|
||||
```bash
|
||||
$ vmoption PrintGC
|
||||
@@ -47,7 +47,7 @@ $ vmoption PrintGC
|
||||
PrintGC false MANAGEMENT true
|
||||
```
|
||||
|
||||
#### 更新指定的 option
|
||||
### 更新指定的 option
|
||||
|
||||
```bash
|
||||
$ vmoption PrintGC true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
- [JVM Tool Interface](https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html)
|
||||
|
||||
### 获取对象
|
||||
## 获取对象
|
||||
|
||||
```bash
|
||||
$ vmtool --action getInstances --className java.lang.String --limit 10
|
||||
@@ -32,13 +32,13 @@ $ vmtool --action getInstances --className java.lang.String --limit 10
|
||||
通过 `--limit`参数,可以限制返回值数量,避免获取超大数据时对 JVM 造成压力。默认值是 10。
|
||||
:::
|
||||
|
||||
### 指定 classloader name
|
||||
## 指定 classloader name
|
||||
|
||||
```bash
|
||||
vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext
|
||||
```
|
||||
|
||||
### 指定 classloader hash
|
||||
## 指定 classloader hash
|
||||
|
||||
可以通过`sc`命令查找到加载 class 的 classloader。
|
||||
|
||||
@@ -60,7 +60,7 @@ $ sc -d org.springframework.context.ApplicationContext
|
||||
vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext
|
||||
```
|
||||
|
||||
### 指定返回结果展开层数
|
||||
## 指定返回结果展开层数
|
||||
|
||||
::: tip
|
||||
`getInstances` action 返回结果绑定到`instances`变量上,它是数组。
|
||||
@@ -72,7 +72,7 @@ vmtool --action getInstances -c 19469ea2 --className org.springframework.context
|
||||
vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext -x 2
|
||||
```
|
||||
|
||||
### 执行表达式
|
||||
## 执行表达式
|
||||
|
||||
::: tip
|
||||
`getInstances` action 返回结果绑定到`instances`变量上,它是数组。可以通过`--express`参数执行指定的表达式。
|
||||
@@ -82,7 +82,7 @@ vmtool --action getInstances -c 19469ea2 --className org.springframework.context
|
||||
vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext --express 'instances[0].getBeanDefinitionNames()'
|
||||
```
|
||||
|
||||
### 强制 GC
|
||||
## 强制 GC
|
||||
|
||||
```bash
|
||||
vmtool --action forceGc
|
||||
|
||||
+15
-15
@@ -8,7 +8,7 @@
|
||||
|
||||
让你能方便的观察到指定函数的调用情况。能观察到的范围为:`返回值`、`抛出异常`、`入参`,通过编写 OGNL 表达式进行对应变量的查看。
|
||||
|
||||
### 参数说明
|
||||
## 参数说明
|
||||
|
||||
watch 的参数比较多,主要是因为它能在 4 个不同的场景观察对象
|
||||
|
||||
@@ -40,13 +40,13 @@ watch 的参数比较多,主要是因为它能在 4 个不同的场景观察
|
||||
- 当使用 `-b` 时,由于观察事件点是在函数调用前,此时返回值或异常均不存在
|
||||
- 在 watch 命令的结果里,会打印出`location`信息。`location`有三种可能值:`AtEnter`,`AtExit`,`AtExceptionExit`。对应函数入口,函数正常 return,函数抛出异常。
|
||||
|
||||
### 使用参考
|
||||
## 使用参考
|
||||
|
||||
#### 启动 Demo
|
||||
### 启动 Demo
|
||||
|
||||
启动[快速入门](quick-start.md)里的`math-game`。
|
||||
|
||||
#### 观察函数调用返回时的参数、this 对象和返回值
|
||||
### 观察函数调用返回时的参数、this 对象和返回值
|
||||
|
||||
::: tip
|
||||
观察表达式,默认值是`{params, target, returnObj}`
|
||||
@@ -87,7 +87,7 @@ ts=2021-08-31 15:22:58; [cost=1.020982ms] result=@ArrayList[
|
||||
- 上面的结果里,说明函数被执行了两次,第一次结果是`location=AtExceptionExit`,说明函数抛出异常了,因此`returnObj`是 null
|
||||
- 在第二次结果里是`location=AtExit`,说明函数正常返回,因此可以看到`returnObj`结果是一个 ArrayList
|
||||
|
||||
#### 观察函数调用入口的参数和返回值
|
||||
### 观察函数调用入口的参数和返回值
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b
|
||||
@@ -103,7 +103,7 @@ ts=2018-12-03 19:23:23; [cost=0.0353ms] result=@ArrayList[
|
||||
|
||||
- 对比前一个例子,返回值为空(事件点为函数执行前,因此获取不到返回值)
|
||||
|
||||
#### 同时观察函数调用前和函数返回后
|
||||
### 同时观察函数调用前和函数返回后
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2
|
||||
@@ -146,7 +146,7 @@ ts=2018-12-03 19:29:54; [cost=4.277392ms] result=@ArrayList[
|
||||
|
||||
- 结果的输出顺序和事件发生的先后顺序一致,和命令中 `-s -b` 的顺序无关
|
||||
|
||||
#### 调整`-x`的值,观察具体的函数参数值
|
||||
### 调整`-x`的值,观察具体的函数参数值
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target}" -x 3
|
||||
@@ -182,7 +182,7 @@ ts=2018-12-03 19:34:19; [cost=0.587833ms] result=@ArrayList[
|
||||
- `-x`表示遍历深度,可以调整来打印具体的参数和结果内容,默认值是 1。
|
||||
- `-x`最大值是 4,防止展开结果占用太多内存。用户可以在`ognl`表达式里指定更具体的 field。
|
||||
|
||||
#### 条件表达式的例子
|
||||
### 条件表达式的例子
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0"
|
||||
@@ -196,7 +196,7 @@ ts=2018-12-03 19:36:04; [cost=0.530255ms] result=@ArrayList[
|
||||
|
||||
- 只有满足条件的调用,才会有响应。
|
||||
|
||||
#### 观察异常信息的例子
|
||||
### 观察异常信息的例子
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2
|
||||
@@ -215,7 +215,7 @@ ts=2018-12-03 19:38:00; [cost=1.414993ms] result=@ArrayList[
|
||||
- `-e`表示抛出异常时才触发
|
||||
- express 中,表示异常信息的变量是`throwExp`
|
||||
|
||||
#### 按照耗时进行过滤
|
||||
### 按照耗时进行过滤
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2
|
||||
@@ -234,7 +234,7 @@ ts=2018-12-03 19:40:28; [cost=2112.168897ms] result=@ArrayList[
|
||||
|
||||
- `#cost>200`(单位是`ms`)表示只有当耗时大于 200ms 时才会输出,过滤掉执行时间小于 200ms 的调用
|
||||
|
||||
#### 观察当前对象中的属性
|
||||
### 观察当前对象中的属性
|
||||
|
||||
如果想查看函数运行前后,当前对象中的属性,可以使用`target`关键字,代表当前对象
|
||||
|
||||
@@ -258,7 +258,7 @@ ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8]
|
||||
ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8]
|
||||
```
|
||||
|
||||
#### 获取类的静态字段、调用类的静态函数的例子
|
||||
### 获取类的静态字段、调用类的静态函数的例子
|
||||
|
||||
```bash
|
||||
watch demo.MathGame * '{params,@demo.MathGame@random.nextInt(100)}' -v -n 1 -x 2
|
||||
@@ -275,7 +275,7 @@ ts=2021-01-05 21:35:20; [cost=0.173966ms] result=@ArrayList[
|
||||
|
||||
- 注意这里使用 `Thread.currentThread().getContextClassLoader()` 加载,使用精确`classloader` [ognl](ognl.md)更好。
|
||||
|
||||
#### 排除掉指定的类
|
||||
### 排除掉指定的类
|
||||
|
||||
::: tip
|
||||
watch/trace/monitor/stack/tt 命令都支持 `--exclude-class-pattern` 参数
|
||||
@@ -287,7 +287,7 @@ watch/trace/monitor/stack/tt 命令都支持 `--exclude-class-pattern` 参数
|
||||
watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter
|
||||
```
|
||||
|
||||
#### 不匹配子类
|
||||
### 不匹配子类
|
||||
|
||||
默认情况下 watch/trace/monitor/stack/tt 命令都会匹配子类。如果想不匹配,可以通过全局参数关掉。
|
||||
|
||||
@@ -295,7 +295,7 @@ watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter
|
||||
options disable-sub-class true
|
||||
```
|
||||
|
||||
#### 使用 -v 参数打印更多信息
|
||||
### 使用 -v 参数打印更多信息
|
||||
|
||||
::: tip
|
||||
watch/trace/monitor/stack/tt 命令都支持 `-v` 参数
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[`Web Console`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=case-web-console)
|
||||
|
||||
### 通过浏览器连接 arthas
|
||||
## 通过浏览器连接 arthas
|
||||
|
||||
Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接访问:[http://127.0.0.1:8563/](http://127.0.0.1:8563/)。
|
||||
|
||||
@@ -21,7 +21,7 @@ Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接
|
||||
3.5.4 版本后,在 Web Console 可以鼠标右键复制粘贴。
|
||||
:::
|
||||
|
||||
### scrollback URL 参数
|
||||
## scrollback URL 参数
|
||||
|
||||
::: tip
|
||||
3.5.5 版本后支持
|
||||
@@ -31,6 +31,6 @@ Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接
|
||||
|
||||
[http://127.0.0.1:8563/?scrollback=3000](http://127.0.0.1:8563/?scrollback=3000)
|
||||
|
||||
### 使用 arthas tunnel server 连接远程 arthas
|
||||
## 使用 arthas tunnel server 连接远程 arthas
|
||||
|
||||
参考:[Arthas Tunnel](tunnel.md)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Arthas is a Java diagnostic tool open-sourced by Alibaba middleware team. It is widely adopted and popular among the developers inside Alibaba. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers.
|
||||
|
||||
### Background
|
||||
## Background
|
||||
|
||||
Oftentimes the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. What's even worse, debugging in production environment is unacceptable, as it will suspend all the threads, leading to services downtime.
|
||||
|
||||
@@ -14,7 +14,7 @@ And if you're thinking of adding some logs to your code to help trouble-shoot th
|
||||
|
||||
Arthas is built to solve these issues. A developer can troubleshoot production issues on the fly. No JVM restart, no additional code changes. Arthas works as an observer, that is, it will never suspend your running threads.
|
||||
|
||||
### Key features
|
||||
## Key features
|
||||
|
||||
- Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts)
|
||||
- Decompile a class to ensure the code is running as expected.
|
||||
@@ -33,6 +33,6 @@ Arthas is built to solve these issues. A developer can troubleshoot production i
|
||||
|
||||
**If you are using Arthas, please let us know. Your feedback is very important to us: [View](https://github.com/alibaba/arthas/issues/111)**
|
||||
|
||||
### Contributors
|
||||
## Contributors
|
||||
|
||||
[](https://github.com/alibaba/arthas/graphs/contributors)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Authenticates the current session
|
||||
:::
|
||||
|
||||
### Configure username and password
|
||||
## Configure username and password
|
||||
|
||||
When attaching, you can specify a password on the command line. such as:
|
||||
|
||||
@@ -20,7 +20,7 @@ java -jar arthas-boot.jar --password ppp
|
||||
Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh
|
||||
```
|
||||
|
||||
### Local connection does not require authentication
|
||||
## Local connection does not require authentication
|
||||
|
||||
By default, there are configurations in the `arthas.properties` file:
|
||||
|
||||
@@ -30,7 +30,7 @@ arthas.localConnectionNonAuth=true
|
||||
|
||||
When the password is configured, connect from localhost, the authentication is not required. The default configuration value is true, which is convenient for local connection. Authentication is only required when connecting remotely.
|
||||
|
||||
### Authenticate in the telnet console
|
||||
## Authenticate in the telnet console
|
||||
|
||||
After connecting to arthas, directly executing the command will prompt for authentication:
|
||||
|
||||
@@ -48,15 +48,15 @@ Authentication result: true
|
||||
|
||||
- The user can be specified by the `--username` option, the default value is `arthas`.
|
||||
|
||||
### Web console Authentication
|
||||
## Web console Authentication
|
||||
|
||||
Open the browser, there will be a pop-up window prompting you to enter your username and password.
|
||||
|
||||
After success, you can directly connect to the web console.
|
||||
|
||||
### HTTP API Authentication
|
||||
## HTTP API Authentication
|
||||
|
||||
#### HTTP Authorization Header(recommended)
|
||||
### HTTP Authorization Header(recommended)
|
||||
|
||||
Arthas uses the HTTP standard Basic Authorization.
|
||||
|
||||
@@ -70,7 +70,7 @@ curl 'http://localhost:8563/api' \
|
||||
--data-raw '{"action":"exec","command":"version"}'
|
||||
```
|
||||
|
||||
#### URL parameters
|
||||
### URL parameters
|
||||
|
||||
It supports passing username and password in parameters. such as:
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Encode and decode using Base64 representation.
|
||||
:::
|
||||
|
||||
### Encode to base64
|
||||
## Encode to base64
|
||||
|
||||
```bash
|
||||
[arthas@70070]$ echo 'abc' > /tmp/test.txt
|
||||
@@ -15,20 +15,20 @@ abc
|
||||
YWJjCg==
|
||||
```
|
||||
|
||||
### Encode to base64 and save output to file
|
||||
## Encode to base64 and save output to file
|
||||
|
||||
```bash
|
||||
$ base64 --input /tmp/test.txt --output /tmp/result.txt
|
||||
```
|
||||
|
||||
### Decode from base64
|
||||
## Decode from base64
|
||||
|
||||
```
|
||||
$ base64 -d /tmp/result.txt
|
||||
abc
|
||||
```
|
||||
|
||||
### Decode from base64 and save output to file
|
||||
## Decode from base64 and save output to file
|
||||
|
||||
```bash
|
||||
$ base64 -d /tmp/result.txt --output /tmp/bbb.txt
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
With the help of Batch Processing, you can run multiple commands in batch and get the final result at the end.
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### Step 1: Create the script
|
||||
### Step 1: Create the script
|
||||
|
||||
Create a `test.as` script suffixed with `as`. Here `as` is suggested for the suffix of the filename, but in fact any suffix is acceptable.
|
||||
|
||||
@@ -24,7 +24,7 @@ Note:
|
||||
- Commands such as `watch`/`tt`/`trace`/`monitor`/`stack` should include `-n` option to ensure the script can be able to quit.
|
||||
- Also consider to use `async` (for example: `watch c.t.X test returnObj > &`) to put commands run at background and get the output from the log file, see more from [asynchronous job](async.md)
|
||||
|
||||
#### Step 2: Run the script
|
||||
### Step 2: Run the script
|
||||
|
||||
Use `-f` to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this:
|
||||
|
||||
@@ -38,7 +38,7 @@ Use `-c` also can specify the commands, like this:
|
||||
./as.sh -c 'sysprop; thread' 56328 > test.out
|
||||
```
|
||||
|
||||
#### Step 3: Check the output
|
||||
### Step 3: Check the output
|
||||
|
||||
```bash
|
||||
cat test.out
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Concatenate and print files
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ cat /tmp/a.txt
|
||||
```
|
||||
|
||||
@@ -8,7 +8,7 @@ View hierarchy, urls and classes-loading info for the class-loaders.
|
||||
|
||||
`classloader` can search and print out the URLs for a specified resource from one particular classloader. It is quite handy when analyzing `ResourceNotFoundException`.
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :----------------------------------------------------------------------------------------------------------- |
|
||||
@@ -20,9 +20,9 @@ View hierarchy, urls and classes-loading info for the class-loaders.
|
||||
| `[c: r:]` | using ClassLoader to search resource |
|
||||
| `[c: load:]` | using ClassLoader to load class |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### View statistics categorized by class type
|
||||
### View statistics categorized by class type
|
||||
|
||||
```bash
|
||||
$ classloader
|
||||
@@ -35,7 +35,7 @@ $ classloader
|
||||
Affect(row-cnt:5) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### View statistics categorized by loaded classes number
|
||||
### View statistics categorized by loaded classes number
|
||||
|
||||
```bash
|
||||
$ classloader -l
|
||||
@@ -47,7 +47,7 @@ $ classloader -l
|
||||
Affect(row-cnt:4) cost in 2 ms.
|
||||
```
|
||||
|
||||
#### View class-loaders hierarchy
|
||||
### View class-loaders hierarchy
|
||||
|
||||
```bash
|
||||
$ classloader -t
|
||||
@@ -58,7 +58,7 @@ $ classloader -t
|
||||
Affect(row-cnt:4) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### Show the URLs of the URLClassLoader
|
||||
### Show the URLs of the URLClassLoader
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69
|
||||
@@ -80,7 +80,7 @@ file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar
|
||||
Affect(row-cnt:9) cost in 3 ms.
|
||||
```
|
||||
|
||||
#### Use the classloader to load resource
|
||||
### Use the classloader to load resource
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69 -r META-INF/MANIFEST.MF
|
||||
@@ -96,7 +96,7 @@ $ classloader -c 1b6d3586 -r java/lang/String.class
|
||||
jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class
|
||||
```
|
||||
|
||||
#### Use the classloader to load class
|
||||
### Use the classloader to load class
|
||||
|
||||
```bash
|
||||
$ classloader -c 3d4eac69 --load demo.MathGame
|
||||
@@ -123,7 +123,7 @@ load class success.
|
||||
classLoaderHash 3d4eac69
|
||||
```
|
||||
|
||||
#### Statistics ClassLoader actually used URLs and unused URLs
|
||||
### Statistics ClassLoader actually used URLs and unused URLs
|
||||
|
||||
::: warning
|
||||
Note that statistics are based on all classes currently loaded by the JVM. Does not mean that `Unused URLs` can be removed from the application. Because it may be necessary to load classes from `Unused URLs` in the future, or to load `resources`.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
- [jvm](jvm.md) - show JVM information
|
||||
- [logger](logger.md) - print the logger information, update the logger level
|
||||
- [mbean](mbean.md) - show Mbean information
|
||||
- [memory](memory.md) - show JVM memory information
|
||||
- [ognl](ognl.md) - execute ognl expression
|
||||
- [perfcounter](perfcounter.md) - show JVM Perf Counter information
|
||||
- [sysenv](sysenv.md) — view system environment variables
|
||||
@@ -39,6 +40,10 @@
|
||||
- [tt](tt.md) - time tunnel, record the arguments and returned value for the methods and replay
|
||||
- [watch](watch.md) - display the input/output parameter, return object, and thrown exception of specified method invocation
|
||||
|
||||
## profiler/flame graph
|
||||
|
||||
- [profiler](profiler.md) - use [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) to generate flame graph
|
||||
|
||||
## authentication
|
||||
|
||||
- [auth](auth.md) - authentication
|
||||
@@ -47,15 +52,11 @@
|
||||
|
||||
- [options](options.md) - check/set Arthas global options
|
||||
|
||||
## profiler/flame graph
|
||||
|
||||
- [profiler](profiler.md) - use [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) to generate flame graph
|
||||
|
||||
## pipe
|
||||
|
||||
Arthas provides `pipe` to process the result returned from commands further, e.g. `sm java.lang.String * | grep 'index'`. Commands supported in `pipe`:
|
||||
|
||||
- grep - filter the result with the given keyword
|
||||
- [grep](grep.md)- filter the result with the given keyword
|
||||
- plaintext - remove the ANSI color
|
||||
- wc - count lines
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ This is the real time statistics dashboard for the current system, press `Ctrl+C
|
||||
|
||||
When running in Apache Tomcat Alibaba edition, the dashboard will also present the real time statistics of the tomcat, including [QPS](https://en.wikipedia.org/wiki/Queries_per_second), RT, error counts, and thread pool, etc.
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| ---: | :--------------------------------------------------------------- |
|
||||
| [i:] | The interval (in ms) between two executions, default is 5000 ms. |
|
||||
| [n:] | The number of times this command will be executed. |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ dashboard
|
||||
@@ -52,7 +52,7 @@ processors 8
|
||||
uptime 272s
|
||||
```
|
||||
|
||||
### Notes on column headers
|
||||
## Notes on column headers
|
||||
|
||||
- ID: JVM thread ID, pls. note this ID is different from the nativeID in jstack
|
||||
- NAME: thread name
|
||||
@@ -66,7 +66,7 @@ uptime 272s
|
||||
- INTERRUPTED: the thread interruption state
|
||||
- DAEMON: daemon thread or not
|
||||
|
||||
#### JVM internal threads
|
||||
### JVM internal threads
|
||||
|
||||
After Java 8, it is supported to obtain the CPU time of JVM internal threads. These threads only have the name and CPU time,
|
||||
without ID and status information (display ID is -1).
|
||||
@@ -84,6 +84,6 @@ JVM internal threads include the following:
|
||||
- GC thread: such as `GC Thread0`, `G1 Young RemSet Sampling`
|
||||
- Other internal threads: such as`VM Periodic Task Thread`, `VM Thread`, `Service Thread`
|
||||
|
||||
### Screenshot
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Dump the bytecode for the particular classes to the specified directory.
|
||||
:::
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :-------------------------------------------------------------------------- |
|
||||
@@ -16,7 +16,7 @@ Dump the bytecode for the particular classes to the specified directory.
|
||||
| `[d:]` | set the destination directory for class files |
|
||||
| `[E]` | turn on regex match, the default behavior is wild card match |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ dump java.lang.String
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
write arguments to the standard output.
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ echo 'hello'
|
||||
```
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
[`getstatic` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=command-getstatic)
|
||||
|
||||
## Usage
|
||||
|
||||
- It is recommended to use the [OGNL] (ognl.md) command, which will be more flexible.
|
||||
|
||||
Check the static fields of classes conveniently, the usage is `getstatic class_name field_name`.
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Similar to the traditional `grep` command.
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
USAGE:
|
||||
grep [-A <value>] [-B <value>] [-C <value>] [-h] [-i] [-v] [-n] [-m <value>] [-e] [--trim-end] pattern
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
dump java heap in hprof binary format, like `jmap`.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### Dump to file
|
||||
### Dump to file
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump /tmp/dump.hprof
|
||||
@@ -16,7 +16,7 @@ Dumping heap to /tmp/dump.hprof...
|
||||
Heap dump file created
|
||||
```
|
||||
|
||||
#### Dump only live objects
|
||||
### Dump only live objects
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump --live /tmp/dump.hprof
|
||||
@@ -24,7 +24,7 @@ Dumping heap to /tmp/dump.hprof...
|
||||
Heap dump file created
|
||||
```
|
||||
|
||||
#### Dump to tmp file
|
||||
### Dump to tmp file
|
||||
|
||||
```bash
|
||||
[arthas@58205]$ heapdump
|
||||
|
||||
@@ -6,14 +6,14 @@ show help message, the command can show all the commands that current Arthas ser
|
||||
[help command] equals [command -help],both is to show the detail usage of one command.
|
||||
:::
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| ------: | :-------------------------------------------------------- |
|
||||
| | show all the commands that current Arthas server supports |
|
||||
| [name:] | show the detail usage of one command |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ help
|
||||
|
||||
@@ -6,14 +6,14 @@ view command history.
|
||||
history of commands will persisted in a file named history, so the history command can show all the history commands of current Arthas server ,but not only history in current session.
|
||||
:::
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| ---: | :----------------------------- |
|
||||
| [c:] | clear all the history commands |
|
||||
| [n:] | view the nearest 5 commands |
|
||||
|
||||
### 使用参考
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
#view the nearest 3 commands
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[`Http API` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=case-http-api)
|
||||
|
||||
### Overview
|
||||
## Overview
|
||||
|
||||
Http API provides a RESTful-like interactive interface, and both
|
||||
requests and responses data in JSON format. Compared with
|
||||
@@ -10,7 +10,7 @@ Telnet/WebConsole's output unstructured text data, Http API can provide
|
||||
structured data and support more complex interactive functions, such as
|
||||
a series of diagnostic operations in specific application scenarios.
|
||||
|
||||
#### Access address
|
||||
### Access address
|
||||
|
||||
The Http API address is: `http://ip:port/api`, the request parameters
|
||||
must be submitted using `POST`. Such as POST
|
||||
@@ -20,7 +20,7 @@ Note: The telnet port `3658` has compatibility issues with the Chrome
|
||||
browser. It is recommended to use the http port `8563` to access the
|
||||
http api.
|
||||
|
||||
#### Request data format
|
||||
### Request data format
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -48,7 +48,7 @@ Request data format description:
|
||||
Note: Different actions use different parameters. Set the parameters
|
||||
according to the specific action.
|
||||
|
||||
#### Request Actions
|
||||
### Request Actions
|
||||
|
||||
Currently supported request actions are as follows:
|
||||
|
||||
@@ -66,7 +66,7 @@ Currently supported request actions are as follows:
|
||||
sharing the same Arthas session.
|
||||
- `close_session` : Close the session.
|
||||
|
||||
#### Response status
|
||||
### Response status
|
||||
|
||||
The state attribute in the response indicates the request processing
|
||||
state, and its value is as follows:
|
||||
@@ -80,7 +80,7 @@ state, and its value is as follows:
|
||||
- `REFUSED`: The request is rejected (completed status), usually
|
||||
accompanied by a message explaining the reason;
|
||||
|
||||
### One-time command
|
||||
## One-time command
|
||||
|
||||
Similar to executing batch commands, the one-time commands are executed
|
||||
synchronously. No need to create a session, no need to set the
|
||||
@@ -184,7 +184,7 @@ Please try to deal with it in the following way:
|
||||
not hit, even if `-n 1` is specified, it will hang and wait until the
|
||||
execution timeout.
|
||||
|
||||
### Session interaction
|
||||
## Session interaction
|
||||
|
||||
Users create and manage Arthas sessions, which are suitable for complex
|
||||
interactive processes. The access process is as follows:
|
||||
@@ -196,7 +196,7 @@ interactive processes. The access process is as follows:
|
||||
- Interrupt command execution
|
||||
- Close the session
|
||||
|
||||
#### Create session
|
||||
### Create session
|
||||
|
||||
```bash
|
||||
curl -Ss -XPOST http://localhost:8563/api -d '
|
||||
@@ -219,7 +219,7 @@ Response result:
|
||||
The new session ID is: `b09f1353-202c-407b-af24-701b744f971e`, and
|
||||
consumer ID is: `5ae4e5fbab8b4e529ac404f260d4e2d1_1`.
|
||||
|
||||
#### Join session
|
||||
### Join session
|
||||
|
||||
Specify the session ID to join, and the server will assign a new
|
||||
consumer ID. Multiple consumers can receive the same command results of
|
||||
@@ -248,7 +248,7 @@ Response result:
|
||||
|
||||
The new consumer ID is `8f7f6ad7bc2d4cb5aa57a530927a95cc_2 ` .
|
||||
|
||||
#### Pull command results
|
||||
### Pull command results
|
||||
|
||||
The action of pulling the command result message is `pull_results`.
|
||||
Please use the Http long-polling method to periodically pull the result
|
||||
@@ -322,7 +322,7 @@ The response content is as follows:
|
||||
}
|
||||
```
|
||||
|
||||
#### Execute commands asynchronously
|
||||
### Execute commands asynchronously
|
||||
|
||||
```bash
|
||||
curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
@@ -449,7 +449,7 @@ corresponds to the expression in the corresponding order.
|
||||
|
||||
Please refer to the section "[Make watch command output a map object](#change_watch_value_to_map)".
|
||||
|
||||
#### Interrupt command execution
|
||||
### Interrupt command execution
|
||||
|
||||
Interrupt the running foreground job of the session:
|
||||
|
||||
@@ -472,7 +472,7 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
}
|
||||
```
|
||||
|
||||
#### Close session
|
||||
### Close session
|
||||
|
||||
Specify the session ID to close the session.
|
||||
|
||||
@@ -491,11 +491,11 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
|
||||
}
|
||||
```
|
||||
|
||||
### Authentication
|
||||
## Authentication
|
||||
|
||||
- Reference: [auth](auth.md)
|
||||
|
||||
### Web UI
|
||||
## Web UI
|
||||
|
||||

|
||||
|
||||
@@ -521,9 +521,9 @@ Pending function:
|
||||
|
||||
<a id="special_command_results"></a>
|
||||
|
||||
### Special command results
|
||||
## Special command results
|
||||
|
||||
#### status
|
||||
### status
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -551,7 +551,7 @@ When the command execution fails, an error message is generally provided, such a
|
||||
}
|
||||
```
|
||||
|
||||
#### input_status
|
||||
### input_status
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -577,7 +577,7 @@ Possible values of `inputStatus`:
|
||||
- `DISABLED` : In the disabled state, commands cannot be entered or
|
||||
interrupted.
|
||||
|
||||
#### command
|
||||
### command
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -594,7 +594,7 @@ It is used for the interactive UI to echo the commands entered by the
|
||||
user. The pulled session command message history will contain messages
|
||||
of type `command`, which can be processed in order.
|
||||
|
||||
#### enhancer
|
||||
### enhancer
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -617,9 +617,9 @@ receive this `enhancer` result. It may happen that the result of
|
||||
`enhancer` is successful, but there is no hit method. The client can
|
||||
prompt the user according to the result of `enhancer`.
|
||||
|
||||
### Cases
|
||||
## Cases
|
||||
|
||||
#### Get classpath of Java application
|
||||
### Get classpath of Java application
|
||||
|
||||
Get system properties of the Java application through Http api and
|
||||
extract the value of `java.class.path`.
|
||||
@@ -661,7 +661,7 @@ NOTE:
|
||||
|
||||
<a id="change_watch_value_to_map"></a>
|
||||
|
||||
#### Make watch command output a map object
|
||||
### Make watch command output a map object
|
||||
|
||||
The result value of `watch` is generated by calculating the
|
||||
`watch-express` ognl expression. You can change the ognl expression to
|
||||
|
||||
@@ -11,7 +11,7 @@ Decompile the specified classes.
|
||||
- The decompiled code is syntax highlighted for better readability in Arthas console.
|
||||
- It is possible that there's grammar error in the decompiled code, but it should not affect your interpretation.
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :-------------------------------------------------------------- |
|
||||
@@ -20,9 +20,9 @@ Decompile the specified classes.
|
||||
| `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. |
|
||||
| `[E]` | turn on regex match while the default is wildcard match |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### Decompile `java.lang.String`
|
||||
### Decompile `java.lang.String`
|
||||
|
||||
```java
|
||||
$ jad java.lang.String
|
||||
@@ -60,7 +60,7 @@ Location:
|
||||
...
|
||||
```
|
||||
|
||||
#### Print source only
|
||||
### Print source only
|
||||
|
||||
By default, the decompile result will have the `ClassLoader` information. With the `--source-only` option, you can print only the source code. Conveniently used with the [mc](mc.md)/[retransform](retransform.md) commands.
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MathGame {
|
||||
...
|
||||
```
|
||||
|
||||
#### Decompile the specified method
|
||||
### Decompile the specified method
|
||||
|
||||
```java
|
||||
$ jad demo.MathGame main
|
||||
@@ -105,7 +105,7 @@ Location:
|
||||
}
|
||||
```
|
||||
|
||||
#### Do not print line numbers
|
||||
### Do not print line numbers
|
||||
|
||||
- `--lineNumber`: Output source code contins line numbers, default value true
|
||||
|
||||
@@ -128,7 +128,7 @@ public static void main(String[] args) throws InterruptedException {
|
||||
}
|
||||
```
|
||||
|
||||
#### Decompile with specified classLoader
|
||||
### Decompile with specified classLoader
|
||||
|
||||
::: tip
|
||||
If the target class is loaded by multiple classloaders, `jad` outputs the `hashcode` of the corresponding classloaders, then you can re-run `jad` and specify `-c <hashcode>` to decompile the target class from the specified classloader.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Check the current JVM's info
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ jvm
|
||||
@@ -110,7 +110,7 @@ RUNTIME
|
||||
Affect(row-cnt:0) cost in 88 ms.
|
||||
```
|
||||
|
||||
### Thread related
|
||||
## Thread related
|
||||
|
||||
- COUNT: the count of active threads
|
||||
- DAEMON-COUNT: the count of active daemon threads
|
||||
@@ -118,7 +118,7 @@ Affect(row-cnt:0) cost in 88 ms.
|
||||
- STARTED-COUNT: the total count of the created threads since JVM starts
|
||||
- DEADLOCK-COUNT: the count of deadlocked threads
|
||||
|
||||
### File descriptor related
|
||||
## File descriptor related
|
||||
|
||||
- MAX-FILE-DESCRIPTOR-COUNT:the count of max file descriptor JVM process can open
|
||||
- OPEN-FILE-DESCRIPTOR-COUNT:the current count of file descriptor JVM process open
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Arthas Console Keymap
|
||||
# keymap
|
||||
|
||||
[`keymap` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=command-keymap)
|
||||
|
||||
@@ -31,7 +31,7 @@ The default keymap is:
|
||||
- Press `tab` to enable auto-completion prompt at any time.
|
||||
- Enter command and `-` or `--`, then press `tab` to display the concrete options for the current command.
|
||||
|
||||
#### Custom shortcuts
|
||||
## Custom shortcuts
|
||||
|
||||
Specify customization in `$USER_HOME/.arthas/conf/inputrc` file in the current user home directory.
|
||||
|
||||
@@ -61,7 +61,7 @@ Vim user may want to map `ctrl+h` to moving the cursor forward one character. To
|
||||
|
||||
then replace `"\C-h": backward-delete-char` with `"\C-h": backward-char`, then reconnect to Arthas console to take effect.
|
||||
|
||||
#### Shortcuts for jobs
|
||||
## Shortcuts for jobs
|
||||
|
||||
- `ctrl + c`: Terminates current command
|
||||
- `ctrl + z`: Suspends the current command, you can restore this command with `bg`/`fg`, or `kill` it.
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
Print the logger information, update the logger level
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### Print the logger information
|
||||
### Print the logger information
|
||||
|
||||
Take the following `logback.xml` as an example:
|
||||
|
||||
@@ -82,7 +82,7 @@ In the `appenders` section:
|
||||
- `APPLICATION` logger is `RollingFileAppender`, the file is `app.log`
|
||||
- `ASYNC` its `appenderRef` is `APPLICATION`, which means asynchronous output to the file
|
||||
|
||||
#### View logger information for the special name
|
||||
### View logger information for the special name
|
||||
|
||||
```bash
|
||||
[arthas@2062]$ logger -n org.springframework.web
|
||||
@@ -96,7 +96,7 @@ In the `appenders` section:
|
||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
||||
```
|
||||
|
||||
#### View logger information for the special classloader
|
||||
### View logger information for the special classloader
|
||||
|
||||
Note that the hashcode changes, you need to check the current ClassLoader information first, and extract the hashcode corresponding to the ClassLoader.
|
||||
|
||||
@@ -137,14 +137,14 @@ For classloader with only one instance, it can be specified by `--classLoaderCla
|
||||
|
||||
The value of `--classloaderclass` is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, `-c <hashcode>` is dynamic.
|
||||
|
||||
#### Update logger level
|
||||
### Update logger level
|
||||
|
||||
```bash
|
||||
[arthas@2062]$ logger --name ROOT --level debug
|
||||
update logger level success.
|
||||
```
|
||||
|
||||
#### Speecify classloader to update logger level
|
||||
### Speecify classloader to update logger level
|
||||
|
||||
By default,logger command will be executed under SystemClassloader, if the application is a traditional `war`, or using spring boot fat jar, then it needs to specify classloader。
|
||||
|
||||
@@ -154,7 +154,7 @@ You can first use `sc -d yourClassName` to check specified classloader hashcode
|
||||
[arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug
|
||||
```
|
||||
|
||||
#### View the logger information without appenders
|
||||
### View the logger information without appenders
|
||||
|
||||
By default, the `logger` command only prints information about the logger with appenders. If you want to see information about loggers without `appender`, you can use the parameter `--include-no-appender`.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ show Mbean information
|
||||
|
||||
This command can show or monitor Mbean attribute information.
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
| Name | Specification |
|
||||
| ------------------: | :---------------------------------------------------------------------------------------------------- |
|
||||
@@ -19,7 +19,7 @@ This command can show or monitor Mbean attribute information.
|
||||
| [n:] | execution times |
|
||||
| [E] | turn on regex matching while the default mode is wildcard matching. Only effect on the attribute name |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
show all Mbean names:
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
[`mc-retransform` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials?language=en&id=command-mc-retransform)
|
||||
|
||||
## Usage
|
||||
|
||||
::: tip
|
||||
Memory compiler, compiles `.java` files into `.class` files in memory.
|
||||
:::
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
View the JVM memory information.
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ memory
|
||||
|
||||
@@ -14,7 +14,7 @@ A command returning immediately is a command immediately returns with the result
|
||||
|
||||
On Arthas's server side, the command is running as a background job, but the weaved code will not take further effect once the job is terminated, therefore, it will not impact the performance after the job quits. Furthermore, Arthas is designed to have no side effect to the business logic.
|
||||
|
||||
### Items to monitor
|
||||
## Items to monitor
|
||||
|
||||
| Item | Specification |
|
||||
| --------: | :--------------------------------------- |
|
||||
@@ -27,7 +27,7 @@ On Arthas's server side, the command is running as a background job, but the wea
|
||||
| rt | average RT |
|
||||
| fail-rate | failure ratio |
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
Parameter `[c:]` stands for cycles of statistics. Its value is an integer value in seconds.
|
||||
|
||||
@@ -40,7 +40,7 @@ Parameter `[c:]` stands for cycles of statistics. Its value is an integer value
|
||||
| `[c:]` | cycle of statistics, the default value: `120`s |
|
||||
| `[b]` | evaluate the condition-expression before method invoke |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ monitor -c 5 demo.MathGame primeFactors
|
||||
@@ -71,7 +71,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 94 ms.
|
||||
2018-12-03 19:07:03 demo.MathGame primeFactors 2 2 0 3182.72 0.00%
|
||||
```
|
||||
|
||||
#### Evaluate condition-express to filter method (after method call)
|
||||
### Evaluate condition-express to filter method (after method call)
|
||||
|
||||
```bash
|
||||
monitor -c 5 demo.MathGame primeFactors "params[0] <= 2"
|
||||
@@ -98,7 +98,7 @@ Affect(class count: 1 , method count: 1) cost in 19 ms, listenerId: 5
|
||||
2020-09-02 09:42:56 demo.MathGame primeFactors 5 3 2 0.15 40.00%
|
||||
```
|
||||
|
||||
#### Evaluate condition-express to filter method (before method call)
|
||||
### Evaluate condition-express to filter method (before method call)
|
||||
|
||||
```bash
|
||||
monitor -b -c 5 com.test.testes.MathGame primeFactors "params[0] <= 2"
|
||||
|
||||
@@ -8,7 +8,7 @@ Execute ognl expression.
|
||||
|
||||
Since 3.0.5.
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :------------------------------------------------------------------------------------------------------ |
|
||||
@@ -17,7 +17,7 @@ Since 3.0.5.
|
||||
| `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. |
|
||||
| [x] | Expand level of object (1 by default). |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
- [Special usages](https://github.com/alibaba/arthas/issues/71)
|
||||
- [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html)
|
||||
|
||||
@@ -7,7 +7,7 @@ Global options
|
||||
:::
|
||||
|
||||
| Name | Default Value | Description |
|
||||
| ---------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ---- | -------------------------------------------------------------------- |
|
||||
| ---------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| unsafe | false | whether to enhance to system-level class. Use it with caution since JVM may hang |
|
||||
| dump | false | whether to dump enhanced class to the external files. If it's on, enhanced class will be dumped into `/${application dir}/arthas-class-dump/`, the specific output path will be output in the console |
|
||||
| batch-re-transform | true | whether to re-transform matched classes in batch |
|
||||
@@ -15,11 +15,12 @@ Global options
|
||||
| disable-sub-class | false | whether to enable matching child classes. The default value is `true`. If exact match is desire, turn off this flag |
|
||||
| support-default-method | true | whether to enable matching default method in interface. The default value is `true`. Refer to [#1105](https://github.com/alibaba/arthas/issues/1105) |
|
||||
| save-result | false | whether to save execution result. All execution results will be saved to `~/logs/arthas-cache/result.log` when it's turned on |
|
||||
| job-timeout | 1d | default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s) | print-parent-fields | true | This option enables print files in parent class, default value true. |
|
||||
| job-timeout | 1d | default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s) |
|
||||
| print-parent-fields | true | This option enables print files in parent class, default value true. |
|
||||
| verbose | false | This option enables print verbose information |
|
||||
| strict | true | whether to enable strict mode |
|
||||
|
||||
### View all options
|
||||
## View all options
|
||||
|
||||
```bash
|
||||
$ options
|
||||
@@ -63,7 +64,7 @@ $ options
|
||||
false`
|
||||
```
|
||||
|
||||
### Get special option value
|
||||
## Get special option value
|
||||
|
||||
```
|
||||
$ options json-format
|
||||
@@ -78,7 +79,7 @@ $ options json-format
|
||||
By default, `json-format` is false. When set `json-format` to true, commands like `wathc`/`tt` will print result with `json` format.
|
||||
:::
|
||||
|
||||
### Set special option value
|
||||
## Set special option value
|
||||
|
||||
For example, to enable saving command execution result, input the command below:
|
||||
|
||||
@@ -89,7 +90,7 @@ $ options save-result true
|
||||
save-result false true
|
||||
```
|
||||
|
||||
### Set `unsafe` to true to enhance the classes under the `java.*` package
|
||||
## Set `unsafe` to true to enhance the classes under the `java.*` package
|
||||
|
||||
By default, `watch`/`trace`/`tt`/`trace`/`monitor` command do not support classes under `java.*` package. You can set `unsafe` to true to enhance the classes under the `java.*` package.
|
||||
|
||||
@@ -106,7 +107,7 @@ Press Q or Ctrl+C to abort.
|
||||
Affect(class count: 1 , method count: 1) cost in 61 ms, listenerId: 1
|
||||
```
|
||||
|
||||
### Turn off strict mode, allow setting object properties in ognl expressions
|
||||
## Turn off strict mode, allow setting object properties in ognl expressions
|
||||
|
||||
::: tip
|
||||
since 3.6.0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Check the current JVM Perf Counter information.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ perfcounter
|
||||
@@ -34,7 +34,7 @@ $ perfcounter -d
|
||||
java.cls.unloadedClasses Monotonic Events 0
|
||||
```
|
||||
|
||||
### JVM above JDK9
|
||||
## JVM above JDK9
|
||||
|
||||
If the information is not printed, when the application starts, add the following parameters:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ The `profiler` command supports generate flame graph for application hotspots.
|
||||
|
||||
The basic usage of the `profiler` command is `profiler action [actionArg]`
|
||||
|
||||
### Supported Options
|
||||
## Supported Options
|
||||
|
||||
| Name | Specification |
|
||||
| ----------: | :------------------------------------------------------------------------------- |
|
||||
@@ -21,7 +21,7 @@ The basic usage of the `profiler` command is `profiler action [actionArg]`
|
||||
| [d:] | run profiling for specified seconds |
|
||||
| [e:] | which event to trace (cpu, alloc, lock, cache-misses etc.), default value is cpu |
|
||||
|
||||
### Start profiler
|
||||
## Start profiler
|
||||
|
||||
```
|
||||
$ profiler start
|
||||
@@ -32,14 +32,14 @@ Started [cpu] profiling
|
||||
By default, the sample event is `cpu`. Can be specified with the `--event` parameter.
|
||||
:::
|
||||
|
||||
### Get the number of samples collected
|
||||
## Get the number of samples collected
|
||||
|
||||
```
|
||||
$ profiler getSamples
|
||||
23
|
||||
```
|
||||
|
||||
### View profiler status
|
||||
## View profiler status
|
||||
|
||||
```bash
|
||||
$ profiler status
|
||||
@@ -48,9 +48,9 @@ $ profiler status
|
||||
|
||||
Can view which `event` and sampling time.
|
||||
|
||||
### Stop profiler
|
||||
## Stop profiler
|
||||
|
||||
#### Generating html format results
|
||||
### Generating html format results
|
||||
|
||||
By default, the result file is `html` format. You can also specify it with the `--format` parameter:
|
||||
|
||||
@@ -62,7 +62,7 @@ OK
|
||||
|
||||
Or use the file name name format in the `--file` parameter. For example, `--file /tmp/result.html`.
|
||||
|
||||
### View profiler results under arthas-output via browser
|
||||
## View profiler results under arthas-output via browser
|
||||
|
||||
By default, arthas uses port 3658, which can be opened: [http://localhost:3658/arthas-output/](http://localhost:3658/arthas-output/) View the `arthas-output` directory below Profiler results:
|
||||
|
||||
@@ -76,7 +76,7 @@ Click to view specific results:
|
||||
If using the chrome browser, may need to be refreshed multiple times.
|
||||
:::
|
||||
|
||||
### Profiler supported events
|
||||
## Profiler supported events
|
||||
|
||||
Under different platforms and different OSs, the supported events are different. For example, under macos:
|
||||
|
||||
@@ -125,7 +125,7 @@ You can use the `--event` parameter to specify the event to sample, such as samp
|
||||
$ profiler start --event alloc
|
||||
```
|
||||
|
||||
### Resume sampling
|
||||
## Resume sampling
|
||||
|
||||
```bash
|
||||
$ profiler resume
|
||||
@@ -136,7 +136,7 @@ The difference between `start` and `resume` is: `start` is the new start samplin
|
||||
|
||||
You can verify the number of samples by executing `profiler getSamples`.
|
||||
|
||||
### Use `execute` action to execute complex commands
|
||||
## Use `execute` action to execute complex commands
|
||||
|
||||
For example, start sampling:
|
||||
|
||||
@@ -152,14 +152,14 @@ profiler execute 'stop,file=/tmp/result.html'
|
||||
|
||||
Specific format reference: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v2.5/src/arguments.cpp#L50)
|
||||
|
||||
### View all supported actions
|
||||
## View all supported actions
|
||||
|
||||
```bash
|
||||
$ profiler actions
|
||||
Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status]
|
||||
```
|
||||
|
||||
### View version
|
||||
## View version
|
||||
|
||||
```bash
|
||||
$ profiler version
|
||||
@@ -167,7 +167,7 @@ Async-profiler 1.6 built on Sep 9 2019
|
||||
Copyright 2019 Andrei Pangin
|
||||
```
|
||||
|
||||
### Configure framebuf option
|
||||
## Configure framebuf option
|
||||
|
||||
::: tip
|
||||
you encounter `[frame_buffer_overflow]` in the generated result, you need to increase the framebuf (the default value is 1'000'000), which can be configured explicitly, such as:
|
||||
@@ -177,7 +177,7 @@ you encounter `[frame_buffer_overflow]` in the generated result, you need to inc
|
||||
profiler start --framebuf 5000000
|
||||
```
|
||||
|
||||
### Configure include/exclude to filter data
|
||||
## Configure include/exclude to filter data
|
||||
|
||||
If the application is complex and generates a lot of content, and you want to focus on only part of the data, you can filter by include/exclude. such as
|
||||
|
||||
@@ -187,7 +187,7 @@ profiler start --include'java/*' --include'demo/*' --exclude'*Unsafe.park*'
|
||||
|
||||
> Both include/exclude support setting multiple values, but need to be configured at the end of the command line.
|
||||
|
||||
### Specify execution time
|
||||
## Specify execution time
|
||||
|
||||
For example, if you want the profiler to automatically end after 300 seconds, you can specify it with the `-d`/`--duration` parameter:
|
||||
|
||||
@@ -195,7 +195,7 @@ For example, if you want the profiler to automatically end after 300 seconds, yo
|
||||
profiler start --duration 300
|
||||
```
|
||||
|
||||
### Generate jfr format result
|
||||
## Generate jfr format result
|
||||
|
||||
> Note that jfr only supports configuration at `start`. If it is specified at `stop`, it will not take effect.
|
||||
|
||||
@@ -213,6 +213,6 @@ The generated results can be viewed with tools that support the jfr format. such
|
||||
- JDK Mission Control: https://github.com/openjdk/jmc
|
||||
- JProfiler: https://github.com/alibaba/arthas/issues/1416
|
||||
|
||||
### The 'unknown' in profiler result
|
||||
## The 'unknown' in profiler result
|
||||
|
||||
- https://github.com/jvm-profiling-tools/async-profiler/discussions/409
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Return working directory name
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ pwd
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ Load the external `*.class` files to re-define the loaded classes in JVM.
|
||||
|
||||
Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)
|
||||
|
||||
### Frequently asked questions
|
||||
## Frequently asked questions
|
||||
|
||||
::: tip
|
||||
Recommend to use the [retransform](retransform.md) command.
|
||||
@@ -37,14 +37,14 @@ The `redefine` command will conflict with the `jad`/`watch`/`trace`/`monitor`/`t
|
||||
The reason is that in the JDK `redefine` and `retransform` are different mechanisms. When two mechanisms are both used to update the bytecode, only the last modified will take effect.
|
||||
:::
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :-------------------------------------------------------------- |
|
||||
| `[c:]` | hashcode of the class loader |
|
||||
| `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
redefine /tmp/Test.class
|
||||
@@ -52,7 +52,7 @@ redefine -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class
|
||||
redefine --classLoaderClass sun.misc.Launcher$AppClassLoader /tmp/Test.class /tmp/Test\$Inner.class
|
||||
```
|
||||
|
||||
### Use with the jad/mc command
|
||||
## Use with the jad/mc command
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
@@ -66,7 +66,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class
|
||||
- `mc` command to compile the modified code
|
||||
- Load new bytecode with `redefine` command
|
||||
|
||||
### Tips for uploading .class files to the server
|
||||
## Tips for uploading .class files to the server
|
||||
|
||||
The `mc` command may fail. You can modify the code locally, compile it, and upload it to the server. Some servers do not allow direct uploading files, you can use the `base64` command to bypass.
|
||||
|
||||
@@ -86,7 +86,7 @@ The `mc` command may fail. You can modify the code locally, compile it, and uplo
|
||||
|
||||
4. Use the md5 command to verify that the `.class` files are consistent.
|
||||
|
||||
### Restrictions of the redefine command
|
||||
## Restrictions of the redefine command
|
||||
|
||||
- New field/method is not allowed
|
||||
- The function that is running, no exit can not take effect, such as the new `System.out.println` added below, only the `run()` function will take effect.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is `stop`.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ reset -h
|
||||
@@ -27,7 +27,7 @@ $ reset -h
|
||||
<class-pattern> Path and classname of Pattern Matching
|
||||
```
|
||||
|
||||
### Reset specified class
|
||||
## Reset specified class
|
||||
|
||||
```
|
||||
$ trace Test test
|
||||
@@ -43,7 +43,7 @@ $ reset Test
|
||||
Affect(class-cnt:1 , method-cnt:0) cost in 11 ms.
|
||||
```
|
||||
|
||||
### Reset all classes
|
||||
## Reset all classes
|
||||
|
||||
```
|
||||
$ trace Test test
|
||||
|
||||
@@ -8,7 +8,7 @@ Load the external `*.class` files to retransform the loaded classes in JVM.
|
||||
|
||||
Reference: [Instrumentation#retransformClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses-java.lang.Class...-)
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
retransform /tmp/Test.class
|
||||
@@ -20,7 +20,7 @@ Reference: [Instrumentation#retransformClasses](https://docs.oracle.com/javase/8
|
||||
retransform --classLoaderClass 'sun.misc.Launcher$AppClassLoader' /tmp/Test.class
|
||||
```
|
||||
|
||||
### retransform the specified .class file
|
||||
## retransform the specified .class file
|
||||
|
||||
```bash
|
||||
$ retransform /tmp/MathGame.class
|
||||
@@ -34,7 +34,7 @@ Load the specified .class file, then parse out the class name, and then retransf
|
||||
If retransform is executed multiple times to load the same class file, there will be multiple retransform entries.
|
||||
:::
|
||||
|
||||
### View retransform entry
|
||||
## View retransform entry
|
||||
|
||||
```bash
|
||||
$ retransform -l
|
||||
@@ -44,7 +44,7 @@ Id ClassName TransformCount LoaderHash LoaderClassName
|
||||
|
||||
- TransformCount counts the times of attempts to return the .class file corresponding to the entry in the ClassFileTransformer#transform method, but it does not mean that the transform must be successful.
|
||||
|
||||
### Delete the specified retransform entry
|
||||
## Delete the specified retransform entry
|
||||
|
||||
Need to specify id:
|
||||
|
||||
@@ -52,13 +52,13 @@ Need to specify id:
|
||||
retransform -d 1
|
||||
```
|
||||
|
||||
### Delete all retransform entries
|
||||
## Delete all retransform entries
|
||||
|
||||
```bash
|
||||
retransform --deleteAll
|
||||
```
|
||||
|
||||
### Explicitly trigger retransform
|
||||
## Explicitly trigger retransform
|
||||
|
||||
```bash
|
||||
$ retransform --classPattern demo.MathGame
|
||||
@@ -70,7 +70,7 @@ demo.MathGame
|
||||
Note: For the same class, when there are multiple retransform entries, if retransform is explicitly triggered, the entry added last will take effect (the one with the largest id).
|
||||
:::
|
||||
|
||||
### Eliminate the influence of retransform
|
||||
## Eliminate the influence of retransform
|
||||
|
||||
If you want to eliminate the impact after performing retransform on a class, you need to:
|
||||
|
||||
@@ -81,7 +81,7 @@ If you want to eliminate the impact after performing retransform on a class, you
|
||||
If you do not clear all retransform entries and trigger retransform again, the retransformed classes will still take effect when arthas stop.
|
||||
:::
|
||||
|
||||
### Use with the jad/mc command
|
||||
## Use with the jad/mc command
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
@@ -95,7 +95,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class
|
||||
- `mc` command to compile the modified code
|
||||
- Load new bytecode with `retransform` command
|
||||
|
||||
### Tips for uploading .class files to the server
|
||||
## Tips for uploading .class files to the server
|
||||
|
||||
The `mc` command may fail. You can modify the code locally, compile it, and upload it to the server. Some servers do not allow direct uploading files, you can use the `base64` command to bypass.
|
||||
|
||||
@@ -115,7 +115,7 @@ The `mc` command may fail. You can modify the code locally, compile it, and uplo
|
||||
|
||||
4. Use the md5 command to verify that the `.class` files are consistent.
|
||||
|
||||
### Restrictions of the retransform command
|
||||
## Restrictions of the retransform command
|
||||
|
||||
- New field/method is not allowed
|
||||
- The function that is running, no exit can not take effect, such as the new `System.out.println` added below, only the `run()` function will take effect.
|
||||
|
||||
@@ -22,7 +22,7 @@ Log command outputs for later analysis
|
||||
|
||||
The command execution result will be save in `{user.home}/logs/arthas-cache/result.log`. Pls. clean it up regularly to save disk space.
|
||||
|
||||
### Use asynchronous job to log
|
||||
## Use asynchronous job to log
|
||||
|
||||
```bash
|
||||
$ trace Test t >> &
|
||||
|
||||
@@ -8,7 +8,7 @@ Search classes loaded by JVM.
|
||||
|
||||
`sc` stands for search class. This command can search all possible classes loaded by JVM and show their information. The supported options are: `[d]`、`[E]`、`[f]` and `[x:]`.
|
||||
|
||||
### Supported Options
|
||||
## Supported Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
@@ -30,7 +30,7 @@ _class-patten_ supports full qualified class name, e.g. com.taobao.test.AAA and
|
||||
`sc` turns on matching sub-class match by default, that is, `sc` will also search the sub classes of the target class too. If exact-match is desired, pls. use `options disable-sub-class true`.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
- Wildcards match search
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ if exits tunnel server,it will also show agentId、tunnelServerUrl、connected
|
||||
if exits statUrl,it will also show statUrl.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ session
|
||||
|
||||
@@ -8,7 +8,7 @@ Search method from the loaded classes.
|
||||
|
||||
`sm` stands for search method. This command can search and show method information from all loaded classes. `sm` can only view the methods declared on the target class, that is, methods from its parent classes are invisible.
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
| Name | Specification |
|
||||
| --------------------: | :----------------------------------------------------------------- |
|
||||
@@ -20,7 +20,7 @@ Search method from the loaded classes.
|
||||
| `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. |
|
||||
| `[n:]` | Maximum number of matching classes with details (100 by default) |
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
View methods of `java.lang.String`:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Add maven dependency:
|
||||
|
||||
When the application is started, spring will start arthas and attach its own process.
|
||||
|
||||
### Configuration properties
|
||||
## Configuration properties
|
||||
|
||||
For example, by configuring the tunnel server for remote management.
|
||||
|
||||
@@ -35,7 +35,7 @@ By default, arthas-spring-boot-starter will disable the `stop` command.
|
||||
|
||||
Reference: [Arthas Properties](arthas-properties.md)
|
||||
|
||||
### View Endpoint Information
|
||||
## View Endpoint Information
|
||||
|
||||
::: tip
|
||||
Need to configure spring boot to expose endpoint: [Reference](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints).
|
||||
@@ -54,7 +54,7 @@ http://localhost:8080/actuator/arthas
|
||||
}
|
||||
```
|
||||
|
||||
### Non-spring boot application usage
|
||||
## Non-spring boot application usage
|
||||
|
||||
Non-Spring Boot applications can be used in the following ways.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Print out the full call stack of the current method.
|
||||
|
||||
Most often we know one method gets called, but we have no idea on which code path gets executed or when the method gets called since there are so many code paths to the target method. The command `stack` comes to rescue in this difficult situation.
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
| Name | Specification |
|
||||
| ---------------------: | :---------------------------------------------------------- |
|
||||
@@ -27,13 +27,13 @@ Pls. refer to [core parameters in expression](advice-class.md) for more details.
|
||||
- Pls. also refer to [https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) for more advanced usage
|
||||
- OGNL official site: [https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
#### Start Demo
|
||||
### Start Demo
|
||||
|
||||
Start `math-game` in [Quick Start](quick-start.md).
|
||||
|
||||
#### stack
|
||||
### stack
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors
|
||||
@@ -44,7 +44,7 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
at demo.MathGame.main(MathGame.java:16)
|
||||
```
|
||||
|
||||
#### Filtering by condition expression
|
||||
### Filtering by condition expression
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors 'params[0]<0' -n 2
|
||||
@@ -61,7 +61,7 @@ ts=2018-12-04 01:34:30;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
Command execution times exceed limit: 2, so command will exit. You can set it with -n option.
|
||||
```
|
||||
|
||||
#### Filtering by cost
|
||||
### Filtering by cost
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors '#cost>5'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Stop
|
||||
# stop
|
||||
|
||||
terminates the Arthas server, all the Arthas clients connecting to this server will be disconnected.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
View the current JVM environment variables.
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
USAGE:
|
||||
@@ -27,7 +27,7 @@ View the current JVM environment variables.
|
||||
<env-name> env name
|
||||
```
|
||||
|
||||
#### View all environment variables
|
||||
### View all environment variables
|
||||
|
||||
```
|
||||
$ sysenv
|
||||
@@ -65,7 +65,7 @@ $ sysenv
|
||||
AUTOJUMP_ERROR_PATH /Users/admin/Library/autojump/errors.log
|
||||
```
|
||||
|
||||
#### View individual environment variables
|
||||
### View individual environment variables
|
||||
|
||||
::: tip
|
||||
Use `tab` for auto-completion
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Examine the system properties from the target JVM
|
||||
:::
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```
|
||||
USAGE:
|
||||
@@ -29,7 +29,7 @@ Examine the system properties from the target JVM
|
||||
<property-value> property value
|
||||
```
|
||||
|
||||
#### Check all properties
|
||||
### Check all properties
|
||||
|
||||
```
|
||||
$ sysprop
|
||||
@@ -104,7 +104,7 @@ $ sysprop
|
||||
sun.cpu.isalist
|
||||
```
|
||||
|
||||
#### Check One Single Property
|
||||
### Check One Single Property
|
||||
|
||||
::: tip
|
||||
Use `tab` for auto-completion
|
||||
@@ -115,7 +115,7 @@ $ sysprop java.version
|
||||
java.version=1.8.0_51
|
||||
```
|
||||
|
||||
#### Modify Single Property
|
||||
### Modify Single Property
|
||||
|
||||
```
|
||||
$ sysprop user.country
|
||||
|
||||
@@ -8,6 +8,8 @@ Similar to the traditional `tee` command, it is used to read standard input data
|
||||
`tee` will read data from standard input device, output its content to standard output device, and save it as a file.
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
USAGE:
|
||||
tee [-a] [-h] [file]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user