|
Arthas从9月份开源以来,受到广大Java开发者的支持,Github Star数三个月超过6000,非常感谢用户支持。同时用户给Arthas提出了很多建议,其中反映最多的是:
在Arthas 3.0.5版本里,我们在用户体验方面做了很多改进,下面逐一介绍。 全平台通用的arthas-bootarthas-boot是新增加的支持全平台的启动器,Windows/Mac/Linux下使用体验一致。下载后,直接java -jar命令启动: wget https://alibaba.github.io/arthas/arthas-boot.jar java -jar arthas-boot.jar arthas-boot的功能比以前的as.sh更强大。
arthas-boot在attach成功之后,会启动一个java telent client去连接Arthas Server,用户没有安装telnet的情况下也可以正常使用。 优先使用当前目录的Arthas在新版本里,默认会从arthas-boot.jar和as.sh所在的目录下查找arthas home,这样子用户全量安装之后,不需要再从远程下载Arthas。
Attach之前先检测端口在之前的版本里,用户困扰最多的是,明明选择了进程A,但是实际连接到的却是进程B。 原因是之前attach了进程B,没有执行shutdown,下次再执行时,还是连接到进程B。 在新版本里,做了改进:
$ java -jar arthas-boot.jar [INFO] Process 1680 already using port 3658 [INFO] Process 1680 already using port 8563 * [1]: 1680 Demo [2]: 35542 [3]: 82334 Demo 3 [ERROR] Target process 82334 is not the process using port 3658, you will connect to an unexpected process. [ERROR] If you still want to attach target process 82334, Try to set a different telnet port by using --telnet-port argument. [ERROR] Or try to shutdown the process 1680 using the telnet port first. 更好的历史命令匹配功能
改进Web Console的体验
新增sysenv命令sysenv命令和sysprop类似,可以打印JVM的环境变量。 新增ognl命令ognl命令提供了单独执行ognl脚本的功能。可以很方便调用各种代码。 比如执行多行表达式,赋值给临时变量,返回一个List:
$ ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
@ArrayList[
@String[/opt/java/8.0.181-zulu/jre],
@String[OpenJDK Runtime Environment],
]
watch命令打印耗时,更方便定位性能瓶颈之前watch命令只支持打印入参返回值等,新版本同时打印出调用耗时,可以很方便定位性能瓶颈。 $ watch demo.MathGame primeFactors 'params[0]' Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 22 ms. ts=2018-11-29 17:53:54; [cost=0.131383ms] result=@Integer[-387929024] ts=2018-11-29 17:53:55; [cost=0.132368ms] result=@Integer[-1318275764] ts=2018-11-29 17:53:56; [cost=0.496598ms] result=@Integer[76446257] ts=2018-11-29 17:53:57; [cost=4.9617ms] result=@Integer[1853966253] 改进类搜索匹配功能,更好支持lambda和内部类之前的版本里,在搜索lambda类时,或者反编绎lambda类有可能会失败。新版本做了修复。比如
$ jad Test$$Lambda$1/1406718218
ClassLoader:
+-sun.misc.Launcher$AppClassLoader@5c647e05
+-sun.misc.Launcher$ExtClassLoader@3c1491ce
Location:
/tmp/classes
/*
* Decompiled with CFR 0_132.
*
* Could not load the following classes:
* Test
* Test$$Lambda$1
*/
import java.lang.invoke.LambdaForm;
import java.util.function.Consumer;
final class Test$$Lambda$1
implements Consumer {
private Test$$Lambda$1() {
}
@LambdaForm.Hidden
public void accept(Object object) {
Test.lambda$0((Integer)((Integer)object));
}
}
更好的tab自动补全改进了很多命令的tab自动补全功能,有停顿时,可以多按tab尝试下。 Release Note详细的Release Note:https://github.com/alibaba/arthas/releases/tag/arthas-all-3.0.5 (责任编辑:IT) |

