启动math-game 启动Arthas 简单使用 简介 Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息,并能在不修改应用代码的情况下,对业务问题进行诊断,包括查看方法调用的出入参、异常,监测方法执行耗时,类加载信息等,大大提升线上问题排查效率。 Arthas(阿尔萨斯)能为你做什么? Ar...
3、jad 反编指定的类或者方法 通过包名,和类名进行反编译,指定的文件,jad demo.MathGame ClassLoader: 下面显示的是类加载器 Location: 下面显示的是启动的jar 4、watch 命令能方便的观察到指定方法的,输入输出参数的调用情况 watch demo.MathGame primeFactors returnObj 包名 方法名 返回结果returnObj 总结 上面...
1.首先下载并启动Arthas官方提供给我们的测试程序 curl -O https://arthas.aliyun.com/math-game.jar java -jar math-game.jar 1. 2. 2.另外再启动一个shell窗口下载并启动arthas工具 curl -O https://arthas.aliyun.com/arthas-boot.jar java -jar arthas-boot.jar 1. 2. 3.输入“1”选择我们的测试...
*/packagedemo;importjava.io.PrintStream;importjava.util.ArrayList;importjava.util.Iterator;importjava.util.List;importjava.util.Random;importjava.util.concurrent.TimeUnit;publicclassMathGame{privatestaticRandomrandom=newRandom();privateintillegalArgumentCount=0;publicstaticvoidmain(String[] args)throwsInterru...
#语法getstatic 类名 属性名# 显示demo.MathGame类中静态属性randomgetstatic demo.MathGame random 9、ognl(执行ognl表达式)执行ognl表达式,这是从3.0.5版本新增的功能。参数说明:express:执行的表达式[c:]:执行表达式的 ClassLoader 的 hashcode,默认值是SystemClassLoader[x]:结果对象的展开层次,默认值1 ...
[arthas@5555]$ watch demo.MathGame primeFactors -e "throwExp" 拦截异常 小王从大到小、逐步分析,找出了问题的原因是 primeFactors 抛出了异常,修正参数后,程序恢复了正常。 3.2.CPU 占用过高 CPU 是程序运行的核心计算资源,一旦出现 CPU 占用过高,必定对大部分用户的访问耗时产生影响。针对这类问题,要定位出...
jad demo.MathGame 通过--source-only参数可以只打印出在反编译的源代码: jad --source-only com.example.demo.arthas.user.UserController 动态执行代码 ognl 命令 在Arthas里,有一个单独的ognl命令,可以动态执行代码。这个有点秀啊 调用static函数 ognl '@java.lang.System@out.println("hello ognl")' ...
watch demo.MathGame primeFactors returnObj watch使用 -x -x参数,指遍历深度,默认为1,如果无法查出数值,可以尝试加大遍历深度。 示例: 遍历深度,默认为1。 result=@ArrayList 后面的结果分别对应 "{params, target, returnObj}" 结果只能看到 result 结果中有多少个参数,没法看到参数的具体值。
watch demo.MathGame primeFactors returnObj 查看JVM信息 sysprop sysenv jvm dashboard sysprop sysprop:打印所有的System Properties信息。 指定单个key:sysprop user.dir。 通过grep过滤 :sysprop | grep user。 设置新的value:sysprop testKey testValue。
启动快速入门里的math-game。 # 记录调用 对于一个最基本的使用来说,就是记录下当前方法的每次调用环境现场。 $ tt -t demo.MathGame primeFactors Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 66 ms. INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD --- 100...