From d0fecd1f7725dfd1725dc6fbfb14c67b8161071b Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Sun, 26 Jul 2020 09:13:01 +0800 Subject: [PATCH 1/6] add sc command scenario. #847 Signed-off-by: hollowman6 --- .../katacoda/command-sc-cn/arthas-boot.md | 16 +++ .../katacoda/command-sc-cn/arthas-demo.md | 10 ++ tutorials/katacoda/command-sc-cn/finish.md | 12 ++ tutorials/katacoda/command-sc-cn/index.json | 35 ++++++ tutorials/katacoda/command-sc-cn/intro.md | 23 ++++ tutorials/katacoda/command-sc-cn/sc.md | 104 ++++++++++++++++++ .../katacoda/command-sc-en/arthas-boot.md | 16 +++ .../katacoda/command-sc-en/arthas-demo.md | 11 ++ tutorials/katacoda/command-sc-en/finish.md | 8 ++ tutorials/katacoda/command-sc-en/index.json | 35 ++++++ tutorials/katacoda/command-sc-en/intro.md | 40 +++++++ tutorials/katacoda/command-sc-en/sc.md | 100 +++++++++++++++++ 12 files changed, 410 insertions(+) create mode 100644 tutorials/katacoda/command-sc-cn/arthas-boot.md create mode 100644 tutorials/katacoda/command-sc-cn/arthas-demo.md create mode 100644 tutorials/katacoda/command-sc-cn/finish.md create mode 100644 tutorials/katacoda/command-sc-cn/index.json create mode 100644 tutorials/katacoda/command-sc-cn/intro.md create mode 100644 tutorials/katacoda/command-sc-cn/sc.md create mode 100644 tutorials/katacoda/command-sc-en/arthas-boot.md create mode 100644 tutorials/katacoda/command-sc-en/arthas-demo.md create mode 100644 tutorials/katacoda/command-sc-en/finish.md create mode 100644 tutorials/katacoda/command-sc-en/index.json create mode 100644 tutorials/katacoda/command-sc-en/intro.md create mode 100644 tutorials/katacoda/command-sc-en/sc.md diff --git a/tutorials/katacoda/command-sc-cn/arthas-boot.md b/tutorials/katacoda/command-sc-cn/arthas-boot.md new file mode 100644 index 00000000000..84ef525a265 --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/arthas-boot.md @@ -0,0 +1,16 @@ + + + + +在新的`Terminal 2`里,下载`arthas-boot.jar`,再用`java -jar`命令启动: + +`wget https://alibaba.github.io/arthas/arthas-boot.jar +java -jar arthas-boot.jar`{{execute T2}} + +`arthas-boot`是`Arthas`的启动程序,它启动后,会列出所有的Java进程,用户可以选择需要诊断的目标进程。 + +选择第一个进程,输入 `1`{{execute T2}} ,再`Enter/回车`: + +Attach成功之后,会打印Arthas LOGO。输入 `help`{{execute T2}} 可以获取到更多的帮助信息。 + +![Arthas Boot](/arthas/scenarios/common-resources/assets/arthas-boot.png) diff --git a/tutorials/katacoda/command-sc-cn/arthas-demo.md b/tutorials/katacoda/command-sc-cn/arthas-demo.md new file mode 100644 index 00000000000..f1136e88e90 --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/arthas-demo.md @@ -0,0 +1,10 @@ + + + + +下载`arthas-demo.jar`,再用`java -jar`命令启动: + +`wget https://alibaba.github.io/arthas/arthas-demo.jar +java -jar arthas-demo.jar`{{execute T1}} + +`arthas-demo`是一个很简单的程序,它随机生成整数,再执行因式分解,把结果打印出来。如果生成的随机数是负数,则会打印提示信息。 diff --git a/tutorials/katacoda/command-sc-cn/finish.md b/tutorials/katacoda/command-sc-cn/finish.md new file mode 100644 index 00000000000..8d5cde752a2 --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/finish.md @@ -0,0 +1,12 @@ + +在“sc”中,我们演示了了Arthas的sc命令。如果有更多的技巧或者使用疑问,欢迎在Issue里提出。 + +* Issues: https://github.com/alibaba/arthas/issues +* 文档: https://alibaba.github.io/arthas + + +如果您在使用Arthas,请让我们知道,您的使用对我们非常重要:[查看](https://github.com/alibaba/arthas/issues/111) + +欢迎关注公众号,获取Arthas项目的信息,源码分析,案例实践。 + +![Arthas公众号](/arthas/scenarios/common-resources/assets/qrcode_gongzhonghao.jpg) \ No newline at end of file diff --git a/tutorials/katacoda/command-sc-cn/index.json b/tutorials/katacoda/command-sc-cn/index.json new file mode 100644 index 00000000000..2da58a1d69d --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/index.json @@ -0,0 +1,35 @@ +{ + "title": "Arthas sc命令", + "description": "Arthas sc命令", + "difficulty": "精通者", + "time": "10-20 分钟", + "details": { + "steps": [ + { + "title": "启动arthas demo", + "text": "arthas-demo.md" + }, + { + "title": "启动arthas-boot", + "text": "arthas-boot.md" + }, + { + "title": "sc命令", + "text": "sc.md" + } + ], + "intro": { + "text": "intro.md" + }, + "finish": { + "text": "finish.md" + } + }, + "environment": { + "uilayout": "terminal" + }, + "backend": { + "imageid": "java", + "environmentsprotocol": "http" + } +} diff --git a/tutorials/katacoda/command-sc-cn/intro.md b/tutorials/katacoda/command-sc-cn/intro.md new file mode 100644 index 00000000000..ddd28085ad7 --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/intro.md @@ -0,0 +1,23 @@ + + + +![Arthas](https://alibaba.github.io/arthas/_images/arthas.png) + +`Arthas` 是Alibaba开源的Java诊断工具,深受开发者喜爱。在线排查问题,无需重启;动态跟踪Java代码;实时监控JVM状态。 + +`Arthas` 支持JDK 6+,支持Linux/Mac/Windows,采用命令行交互模式,同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。 + +当你遇到以下类似问题而束手无策时,Arthas可以帮助你解决: + +- 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception? +- 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了? +- 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? +- 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现! +- 是否有一个全局视角来查看系统的运行状况? +- 有什么办法可以监控到JVM的实时运行状态? +- 怎么快速定位应用的热点,生成火焰图? + +本教程会以一个简单的应用为例,演示sc命令。 + +* Github: https://github.com/alibaba/arthas +* 文档: https://alibaba.github.io/arthas/ diff --git a/tutorials/katacoda/command-sc-cn/sc.md b/tutorials/katacoda/command-sc-cn/sc.md new file mode 100644 index 00000000000..1a3231ebb67 --- /dev/null +++ b/tutorials/katacoda/command-sc-cn/sc.md @@ -0,0 +1,104 @@ + +> 查看JVM已加载的类信息 + +“Search-Class” 的简写,这个命令能搜索出所有已经加载到 JVM 中的 Class 信息,这个命令支持的参数有 `[d]`、`[E]`、`[f]` 和 `[x:]`。 + +参数说明 +--- + +### 参数说明 + +|参数名称|参数说明| +|---:|:---| +|*class-pattern*|类名表达式匹配| +|*method-pattern*|方法名表达式匹配| +|[d]|输出当前类的详细信息,包括这个类所加载的原始文件来源、类的声明、加载的ClassLoader等详细信息。
如果一个类被多个ClassLoader所加载,则会出现多次| +|[E]|开启正则表达式匹配,默认为通配符匹配| +|[f]|输出当前类的成员变量信息(需要配合参数-d一起使用)| +|[x:]|指定输出静态变量时属性的遍历深度,默认为 0,即直接使用 `toString` 输出| + +> class-pattern支持全限定名,如com.taobao.test.AAA,也支持com/taobao/test/AAA这样的格式,这样,我们从异常堆栈里面把类名拷贝过来的时候,不需要在手动把`/`替换为`.`啦。 + +> sc 默认开启了子类匹配功能,也就是说所有当前类的子类也会被搜索出来,想要精确的匹配,请打开`options disable-sub-class true`开关 + +### 使用参考 + +* 模糊搜索 + + `sc demo.*`{{execute T2}} + + ```bash + $ sc demo.* + demo.MathGame + Affect(row-cnt:1) cost in 55 ms. + ``` + +* 打印类的详细信息 + + `sc -d demo.MathGame`{{execute T2}} + + ```bash + $ sc -d demo.MathGame + class-info demo.MathGame + code-source /private/tmp/arthas-demo.jar + name demo.MathGame + isInterface false + isAnnotation false + isEnum false + isAnonymousClass false + isArray false + isLocalClass false + isMemberClass false + isPrimitive false + isSynthetic false + simple-name MathGame + modifier public + annotation + interfaces + super-class +-java.lang.Object + class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69 + +-sun.misc.Launcher$ExtClassLoader@66350f69 + classLoaderHash 3d4eac69 + + Affect(row-cnt:1) cost in 875 ms. + ``` + +* 打印出类的Field信息 + + `sc -d -f demo.MathGame`{{execute T2}} + + ```bash + $ sc -d -f demo.MathGame + class-info demo.MathGame + code-source /private/tmp/arthas-demo.jar + name demo.MathGame + isInterface false + isAnnotation false + isEnum false + isAnonymousClass false + isArray false + isLocalClass false + isMemberClass false + isPrimitive false + isSynthetic false + simple-name MathGame + modifier public + annotation + interfaces + super-class +-java.lang.Object + class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69 + +-sun.misc.Launcher$ExtClassLoader@66350f69 + classLoaderHash 3d4eac69 + fields modifierprivate,static + type java.util.Random + name random + value java.util.Random@522b4 + 08a + + modifierprivate + type int + name illegalArgumentCount + + + Affect(row-cnt:1) cost in 19 ms. + ``` \ No newline at end of file diff --git a/tutorials/katacoda/command-sc-en/arthas-boot.md b/tutorials/katacoda/command-sc-en/arthas-boot.md new file mode 100644 index 00000000000..b9f9cc04f4f --- /dev/null +++ b/tutorials/katacoda/command-sc-en/arthas-boot.md @@ -0,0 +1,16 @@ + + + + +In the new `Terminal 2`, download `arthas-boot.jar` and start with the `java -jar` command: + +`wget https://alibaba.github.io/arthas/arthas-boot.jar +java -jar arthas-boot.jar`{{execute T2}} + +`arthas-boot` is the launcher for `Arthas`. It lists all the Java processes, and the user can select the target process to be diagnosed. + +Select the first process, type `1`{{execute T2}} ,then type `Enter`: + +After the Attach is successful, Arthas LOGO is printed. Enter `help`{{execute T2}} for more help. + +![Arthas Boot](/arthas/scenarios/common-resources/assets/arthas-boot.png) diff --git a/tutorials/katacoda/command-sc-en/arthas-demo.md b/tutorials/katacoda/command-sc-en/arthas-demo.md new file mode 100644 index 00000000000..7ba2cf1faf1 --- /dev/null +++ b/tutorials/katacoda/command-sc-en/arthas-demo.md @@ -0,0 +1,11 @@ + + + + +Download `arthas-demo.jar` and start with the `java -jar` command: + +`wget https://alibaba.github.io/arthas/arthas-demo.jar +java -jar arthas-demo.jar`{{execute T1}} + +`arthas-demo` is a very simple program that randomly generates integers, performs factorization, and prints the results. +If the generated random number is negative, a error message will be printed. diff --git a/tutorials/katacoda/command-sc-en/finish.md b/tutorials/katacoda/command-sc-en/finish.md new file mode 100644 index 00000000000..275361e0b12 --- /dev/null +++ b/tutorials/katacoda/command-sc-en/finish.md @@ -0,0 +1,8 @@ + +The `sc Tutorial` demonstrates the usage of sc. If you have more tips or questions, please feel free to ask in Issue. + +* Issues: https://github.com/alibaba/arthas/issues +* Documentation: https://alibaba.github.io/arthas + + +If you are using Arthas, please let us know. Your use is very important to us: [View](https://github.com/alibaba/arthas/issues/111) \ No newline at end of file diff --git a/tutorials/katacoda/command-sc-en/index.json b/tutorials/katacoda/command-sc-en/index.json new file mode 100644 index 00000000000..1074b9250d1 --- /dev/null +++ b/tutorials/katacoda/command-sc-en/index.json @@ -0,0 +1,35 @@ +{ + "title": "Arthas sc Command", + "description": "Arthas sc Command", + "difficulty": "master", + "time": "10-20 minutes", + "details": { + "steps": [ + { + "title": "Arthas demo", + "text": "arthas-demo.md" + }, + { + "title": "Start arthas-boot", + "text": "arthas-boot.md" + }, + { + "title": "sc Command", + "text": "sc.md" + } + ], + "intro": { + "text": "intro.md" + }, + "finish": { + "text": "finish.md" + } + }, + "environment": { + "uilayout": "terminal" + }, + "backend": { + "imageid": "java", + "environmentsprotocol": "http" + } +} diff --git a/tutorials/katacoda/command-sc-en/intro.md b/tutorials/katacoda/command-sc-en/intro.md new file mode 100644 index 00000000000..69651bdfc6c --- /dev/null +++ b/tutorials/katacoda/command-sc-en/intro.md @@ -0,0 +1,40 @@ + + + +![Arthas](https://alibaba.github.io/arthas/_images/arthas.png) + +`Arthas` is a Java diagnostic tool open-sourced by Alibaba middleware team. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers. + +`Arthas` supports JDK 6+, supports Linux/Mac/Windows. + +## 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. + +Developers could always try to reproduce the same issue on the test/staging environment. However, this is tricky as some issues cannot be reproduced easily in a different environment, or even disappear once restarted. + +And if you’re thinking of adding some logs to your code to help trouble-shoot the issue, you will have to go through the following lifecycle: test, staging, and then to production. Time is money! This approach is inefficient! Worse still, the issue may not be fixed since it might be irreproducible once the JVM is restarted, as described above. + +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 + +- 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. +- Check classloader statistics, e.g. the number of classloaders, the number of classes loaded per classloader, the classloader hierarchy, possible classloader leaks, etc. +- Check the method invocation details, e.g. method parameter, returned values, exceptions and etc. +- Check the stack trace of specified method invocation. This is useful when a developer wants to know the caller of the method. +- Trace the method invocation to find slow sub-invocations. +- Monitor method invocation statistics, e.g. QPS (Query Per Second), RT (Return Time), success rate and etc. +- Monitor system metrics, thread states and CPU usage, GC statistics and etc. +- Supports command line interactive mode, with auto-complete feature enabled. +- Supports telnet and WebSocket, which enables both local and remote diagnostics with command line and browsers. +- Supports profiler/Flame Graph +- Supports JDK 6+ +- Supports Linux/Mac/Windows + +This tutorial takes a simple application as an example to demonstrate the the usage of sc. + +* Github: https://github.com/alibaba/arthas +* Docs: https://alibaba.github.io/arthas/ + diff --git a/tutorials/katacoda/command-sc-en/sc.md b/tutorials/katacoda/command-sc-en/sc.md new file mode 100644 index 00000000000..c0f6f04317f --- /dev/null +++ b/tutorials/katacoda/command-sc-en/sc.md @@ -0,0 +1,100 @@ + +> 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 + +|Name|Specification| +|---:|:---| +|*class-pattern*|pattern for the class name| +|*method-pattern*|pattern for the method name| +|`[d]`|print the details of the current class, including its code source, class specification, its class loader and so on.
If a class is loaded by more than one class loader, then the class details will be printed several times| +|`[E]`|turn on regex match, the default behavior is wildcards match| +|`[f]`|print the fields info of the current class, MUST be used with `-d` together| +|`[x:]`|specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use `toString` to output| + +> *class-patten* supports full qualified class name, e.g. com.taobao.test.AAA and com/taobao/test/AAA. It also supports the format of 'com/taobao/test/AAA', so that it is convenient to directly copy class name from the exception stack trace without replacing '/' to '.'.

+> `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 + +* Wildcards match search + + `sc demo.*`{{execute T2}} + + ```bash + $ sc demo.* + demo.MathGame + Affect(row-cnt:1) cost in 55 ms. + ``` + +* View class details + + `sc -d demo.MathGame`{{execute T2}} + + ```bash + $ sc -d demo.MathGame + class-info demo.MathGame + code-source /private/tmp/arthas-demo.jar + name demo.MathGame + isInterface false + isAnnotation false + isEnum false + isAnonymousClass false + isArray false + isLocalClass false + isMemberClass false + isPrimitive false + isSynthetic false + simple-name MathGame + modifier public + annotation + interfaces + super-class +-java.lang.Object + class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69 + +-sun.misc.Launcher$ExtClassLoader@66350f69 + classLoaderHash 3d4eac69 + + Affect(row-cnt:1) cost in 875 ms. + ``` + +* View class fields + + `sc -d -f demo.MathGame`{{execute T2}} + + ```bash + $ sc -d -f demo.MathGame + class-info demo.MathGame + code-source /private/tmp/arthas-demo.jar + name demo.MathGame + isInterface false + isAnnotation false + isEnum false + isAnonymousClass false + isArray false + isLocalClass false + isMemberClass false + isPrimitive false + isSynthetic false + simple-name MathGame + modifier public + annotation + interfaces + super-class +-java.lang.Object + class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69 + +-sun.misc.Launcher$ExtClassLoader@66350f69 + classLoaderHash 3d4eac69 + fields modifierprivate,static + type java.util.Random + name random + value java.util.Random@522b4 + 08a + + modifierprivate + type int + name illegalArgumentCount + + + Affect(row-cnt:1) cost in 19 ms. + ``` From 6d4bd4e2ddb0e44e63588416ae7e96c6450871ab Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Sun, 26 Jul 2020 09:14:44 +0800 Subject: [PATCH 2/6] add tutorial links Signed-off-by: hollowman6 --- site/src/site/sphinx/en/sc.md | 2 ++ site/src/site/sphinx/sc.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/site/src/site/sphinx/en/sc.md b/site/src/site/sphinx/en/sc.md index 8ec154b5c3b..67999b7c1ba 100644 --- a/site/src/site/sphinx/en/sc.md +++ b/site/src/site/sphinx/en/sc.md @@ -1,6 +1,8 @@ sc == +[`sc` online tutorial](https://alibaba.github.io/arthas/arthas-tutorials?language=en&id=command-sc) + > 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:]`. diff --git a/site/src/site/sphinx/sc.md b/site/src/site/sphinx/sc.md index b56622cb01f..0e2b9049b98 100644 --- a/site/src/site/sphinx/sc.md +++ b/site/src/site/sphinx/sc.md @@ -1,6 +1,8 @@ sc === +[`sc`在线教程](https://alibaba.github.io/arthas/arthas-tutorials?language=cn&id=command-sc) + > 查看JVM已加载的类信息 “Search-Class” 的简写,这个命令能搜索出所有已经加载到 JVM 中的 Class 信息,这个命令支持的参数有 `[d]`、`[E]`、`[f]` 和 `[x:]`。 From fd714b88a76f14b5b072071b4649b9e9d8d058b2 Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Tue, 11 Aug 2020 09:08:44 +0800 Subject: [PATCH 3/6] update link to arthas.aliyun.com. #1411 Signed-off-by: hollowman6 --- tutorials/katacoda/command-sc-cn/arthas-boot.md | 2 +- tutorials/katacoda/command-sc-cn/arthas-demo.md | 2 +- tutorials/katacoda/command-sc-cn/finish.md | 2 +- tutorials/katacoda/command-sc-cn/intro.md | 4 ++-- tutorials/katacoda/command-sc-en/arthas-boot.md | 2 +- tutorials/katacoda/command-sc-en/arthas-demo.md | 2 +- tutorials/katacoda/command-sc-en/finish.md | 2 +- tutorials/katacoda/command-sc-en/intro.md | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tutorials/katacoda/command-sc-cn/arthas-boot.md b/tutorials/katacoda/command-sc-cn/arthas-boot.md index 84ef525a265..5c6cb8a17d0 100644 --- a/tutorials/katacoda/command-sc-cn/arthas-boot.md +++ b/tutorials/katacoda/command-sc-cn/arthas-boot.md @@ -4,7 +4,7 @@ 在新的`Terminal 2`里,下载`arthas-boot.jar`,再用`java -jar`命令启动: -`wget https://alibaba.github.io/arthas/arthas-boot.jar +`wget https://arthas.aliyun.com/doc/arthas-boot.jar java -jar arthas-boot.jar`{{execute T2}} `arthas-boot`是`Arthas`的启动程序,它启动后,会列出所有的Java进程,用户可以选择需要诊断的目标进程。 diff --git a/tutorials/katacoda/command-sc-cn/arthas-demo.md b/tutorials/katacoda/command-sc-cn/arthas-demo.md index f1136e88e90..7b612d3f62c 100644 --- a/tutorials/katacoda/command-sc-cn/arthas-demo.md +++ b/tutorials/katacoda/command-sc-cn/arthas-demo.md @@ -4,7 +4,7 @@ 下载`arthas-demo.jar`,再用`java -jar`命令启动: -`wget https://alibaba.github.io/arthas/arthas-demo.jar +`wget https://arthas.aliyun.com/doc/arthas-demo.jar java -jar arthas-demo.jar`{{execute T1}} `arthas-demo`是一个很简单的程序,它随机生成整数,再执行因式分解,把结果打印出来。如果生成的随机数是负数,则会打印提示信息。 diff --git a/tutorials/katacoda/command-sc-cn/finish.md b/tutorials/katacoda/command-sc-cn/finish.md index 8d5cde752a2..cf03b81faf3 100644 --- a/tutorials/katacoda/command-sc-cn/finish.md +++ b/tutorials/katacoda/command-sc-cn/finish.md @@ -2,7 +2,7 @@ 在“sc”中,我们演示了了Arthas的sc命令。如果有更多的技巧或者使用疑问,欢迎在Issue里提出。 * Issues: https://github.com/alibaba/arthas/issues -* 文档: https://alibaba.github.io/arthas +* 文档: https://arthas.aliyun.com/doc 如果您在使用Arthas,请让我们知道,您的使用对我们非常重要:[查看](https://github.com/alibaba/arthas/issues/111) diff --git a/tutorials/katacoda/command-sc-cn/intro.md b/tutorials/katacoda/command-sc-cn/intro.md index ddd28085ad7..0921235c4f1 100644 --- a/tutorials/katacoda/command-sc-cn/intro.md +++ b/tutorials/katacoda/command-sc-cn/intro.md @@ -1,7 +1,7 @@ -![Arthas](https://alibaba.github.io/arthas/_images/arthas.png) +![Arthas](https://arthas.aliyun.com/doc/_images/arthas.png) `Arthas` 是Alibaba开源的Java诊断工具,深受开发者喜爱。在线排查问题,无需重启;动态跟踪Java代码;实时监控JVM状态。 @@ -20,4 +20,4 @@ 本教程会以一个简单的应用为例,演示sc命令。 * Github: https://github.com/alibaba/arthas -* 文档: https://alibaba.github.io/arthas/ +* 文档: https://arthas.aliyun.com/doc/ diff --git a/tutorials/katacoda/command-sc-en/arthas-boot.md b/tutorials/katacoda/command-sc-en/arthas-boot.md index b9f9cc04f4f..5f6d3f24662 100644 --- a/tutorials/katacoda/command-sc-en/arthas-boot.md +++ b/tutorials/katacoda/command-sc-en/arthas-boot.md @@ -4,7 +4,7 @@ In the new `Terminal 2`, download `arthas-boot.jar` and start with the `java -jar` command: -`wget https://alibaba.github.io/arthas/arthas-boot.jar +`wget https://arthas.aliyun.com/doc/arthas-boot.jar java -jar arthas-boot.jar`{{execute T2}} `arthas-boot` is the launcher for `Arthas`. It lists all the Java processes, and the user can select the target process to be diagnosed. diff --git a/tutorials/katacoda/command-sc-en/arthas-demo.md b/tutorials/katacoda/command-sc-en/arthas-demo.md index 7ba2cf1faf1..2af63aa0d5f 100644 --- a/tutorials/katacoda/command-sc-en/arthas-demo.md +++ b/tutorials/katacoda/command-sc-en/arthas-demo.md @@ -4,7 +4,7 @@ Download `arthas-demo.jar` and start with the `java -jar` command: -`wget https://alibaba.github.io/arthas/arthas-demo.jar +`wget https://arthas.aliyun.com/doc/arthas-demo.jar java -jar arthas-demo.jar`{{execute T1}} `arthas-demo` is a very simple program that randomly generates integers, performs factorization, and prints the results. diff --git a/tutorials/katacoda/command-sc-en/finish.md b/tutorials/katacoda/command-sc-en/finish.md index 275361e0b12..d35385cab0a 100644 --- a/tutorials/katacoda/command-sc-en/finish.md +++ b/tutorials/katacoda/command-sc-en/finish.md @@ -2,7 +2,7 @@ The `sc Tutorial` demonstrates the usage of sc. If you have more tips or questions, please feel free to ask in Issue. * Issues: https://github.com/alibaba/arthas/issues -* Documentation: https://alibaba.github.io/arthas +* Documentation: https://arthas.aliyun.com/doc/en If you are using Arthas, please let us know. Your use is very important to us: [View](https://github.com/alibaba/arthas/issues/111) \ No newline at end of file diff --git a/tutorials/katacoda/command-sc-en/intro.md b/tutorials/katacoda/command-sc-en/intro.md index 69651bdfc6c..6a88245c04f 100644 --- a/tutorials/katacoda/command-sc-en/intro.md +++ b/tutorials/katacoda/command-sc-en/intro.md @@ -1,7 +1,7 @@ -![Arthas](https://alibaba.github.io/arthas/_images/arthas.png) +![Arthas](https://arthas.aliyun.com/doc/_images/arthas.png) `Arthas` is a Java diagnostic tool open-sourced by Alibaba middleware team. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers. @@ -36,5 +36,5 @@ Arthas is built to solve these issues. A developer can troubleshoot production i This tutorial takes a simple application as an example to demonstrate the the usage of sc. * Github: https://github.com/alibaba/arthas -* Docs: https://alibaba.github.io/arthas/ +* Docs: https://arthas.aliyun.com/doc/en From a959e6f2d9f8f00fbf39b15c78dd24a1a513e8e1 Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Tue, 11 Aug 2020 09:09:14 +0800 Subject: [PATCH 4/6] update link to arthas.aliyun.com. #1411 Signed-off-by: hollowman6 --- site/src/site/sphinx/en/sc.md | 2 +- site/src/site/sphinx/sc.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/site/sphinx/en/sc.md b/site/src/site/sphinx/en/sc.md index 67999b7c1ba..495622ecf1f 100644 --- a/site/src/site/sphinx/en/sc.md +++ b/site/src/site/sphinx/en/sc.md @@ -1,7 +1,7 @@ sc == -[`sc` online tutorial](https://alibaba.github.io/arthas/arthas-tutorials?language=en&id=command-sc) +[`sc` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials?language=en&id=command-sc) > Search classes loaded by JVM. diff --git a/site/src/site/sphinx/sc.md b/site/src/site/sphinx/sc.md index 0e2b9049b98..6cdc2f87df7 100644 --- a/site/src/site/sphinx/sc.md +++ b/site/src/site/sphinx/sc.md @@ -1,7 +1,7 @@ sc === -[`sc`在线教程](https://alibaba.github.io/arthas/arthas-tutorials?language=cn&id=command-sc) +[`sc`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=command-sc) > 查看JVM已加载的类信息 From 3a4b06db7eb6850a762673337a3df06138d54ea6 Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Wed, 12 Aug 2020 23:18:18 +0800 Subject: [PATCH 5/6] polish Signed-off-by: hollowman6 --- site/src/site/sphinx/en/sc.md | 2 ++ site/src/site/sphinx/sc.md | 2 ++ tutorials/katacoda/command-sc-cn/sc.md | 2 ++ tutorials/katacoda/command-sc-en/sc.md | 2 ++ 4 files changed, 8 insertions(+) diff --git a/site/src/site/sphinx/en/sc.md b/site/src/site/sphinx/en/sc.md index 495622ecf1f..2f9ec2f2ffa 100644 --- a/site/src/site/sphinx/en/sc.md +++ b/site/src/site/sphinx/en/sc.md @@ -17,6 +17,8 @@ sc |`[E]`|turn on regex match, the default behavior is wildcards match| |`[f]`|print the fields info of the current class, MUST be used with `-d` together| |`[x:]`|specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use `toString` to output| +|`[c:]`|The hash code of the special class's classLoader| +|`[n:]`|Maximum number of matching classes with details (100 by default)| > *class-patten* supports full qualified class name, e.g. com.taobao.test.AAA and com/taobao/test/AAA. It also supports the format of 'com/taobao/test/AAA', so that it is convenient to directly copy class name from the exception stack trace without replacing '/' to '.'.

> `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`. diff --git a/site/src/site/sphinx/sc.md b/site/src/site/sphinx/sc.md index 6cdc2f87df7..4c2a472f72d 100644 --- a/site/src/site/sphinx/sc.md +++ b/site/src/site/sphinx/sc.md @@ -20,6 +20,8 @@ sc |[E]|开启正则表达式匹配,默认为通配符匹配| |[f]|输出当前类的成员变量信息(需要配合参数-d一起使用)| |[x:]|指定输出静态变量时属性的遍历深度,默认为 0,即直接使用 `toString` 输出| +|`[c:]`|指定class的 ClassLoader 的 hashcode| +|`[n:]`|具有详细信息的匹配类的最大数量(默认为100)| > class-pattern支持全限定名,如com.taobao.test.AAA,也支持com/taobao/test/AAA这样的格式,这样,我们从异常堆栈里面把类名拷贝过来的时候,不需要在手动把`/`替换为`.`啦。 diff --git a/tutorials/katacoda/command-sc-cn/sc.md b/tutorials/katacoda/command-sc-cn/sc.md index 1a3231ebb67..d78809f07f8 100644 --- a/tutorials/katacoda/command-sc-cn/sc.md +++ b/tutorials/katacoda/command-sc-cn/sc.md @@ -16,6 +16,8 @@ |[E]|开启正则表达式匹配,默认为通配符匹配| |[f]|输出当前类的成员变量信息(需要配合参数-d一起使用)| |[x:]|指定输出静态变量时属性的遍历深度,默认为 0,即直接使用 `toString` 输出| +|`[c:]`|指定class的 ClassLoader 的 hashcode| +|`[n:]`|具有详细信息的匹配类的最大数量(默认为100)| > class-pattern支持全限定名,如com.taobao.test.AAA,也支持com/taobao/test/AAA这样的格式,这样,我们从异常堆栈里面把类名拷贝过来的时候,不需要在手动把`/`替换为`.`啦。 diff --git a/tutorials/katacoda/command-sc-en/sc.md b/tutorials/katacoda/command-sc-en/sc.md index c0f6f04317f..c21fd39a7fc 100644 --- a/tutorials/katacoda/command-sc-en/sc.md +++ b/tutorials/katacoda/command-sc-en/sc.md @@ -13,6 +13,8 @@ |`[E]`|turn on regex match, the default behavior is wildcards match| |`[f]`|print the fields info of the current class, MUST be used with `-d` together| |`[x:]`|specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use `toString` to output| +|`[c:]`|The hash code of the special class's classLoader| +|`[n:]`|Maximum number of matching classes with details (100 by default)| > *class-patten* supports full qualified class name, e.g. com.taobao.test.AAA and com/taobao/test/AAA. It also supports the format of 'com/taobao/test/AAA', so that it is convenient to directly copy class name from the exception stack trace without replacing '/' to '.'.

> `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`. From 6c74b3f4a9b11e9f371c04ebd61ba86ea993c967 Mon Sep 17 00:00:00 2001 From: hollowman6 Date: Thu, 13 Aug 2020 13:01:06 +0800 Subject: [PATCH 6/6] add '-c' example Signed-off-by: hollowman6 --- tutorials/katacoda/command-sc-cn/sc.md | 6 ++++++ tutorials/katacoda/command-sc-en/sc.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tutorials/katacoda/command-sc-cn/sc.md b/tutorials/katacoda/command-sc-cn/sc.md index d78809f07f8..c4a8b01fbe5 100644 --- a/tutorials/katacoda/command-sc-cn/sc.md +++ b/tutorials/katacoda/command-sc-cn/sc.md @@ -65,6 +65,12 @@ Affect(row-cnt:1) cost in 875 ms. ``` +记住这里的classLoaderHash:`3d4eac69`,并用其替换``,手动执行下一条命令。 + +* 指定classLoader + + `sc -c -d demo*` + * 打印出类的Field信息 `sc -d -f demo.MathGame`{{execute T2}} diff --git a/tutorials/katacoda/command-sc-en/sc.md b/tutorials/katacoda/command-sc-en/sc.md index c21fd39a7fc..9ef794d9394 100644 --- a/tutorials/katacoda/command-sc-en/sc.md +++ b/tutorials/katacoda/command-sc-en/sc.md @@ -61,6 +61,12 @@ Affect(row-cnt:1) cost in 875 ms. ``` +Take a note of the classLoaderHash here:`3d4eac69`, and use it to replace `` and execute the following command. + +* Specify classLoader + + `sc -c -d demo*` + * View class fields `sc -d -f demo.MathGame`{{execute T2}}