问题诊断神器arthas

https://github.com/alibaba/arthas
镜像地址 https://gitee.com/arthas/arthas

OGNL
https://commons.apache.org/proper/commons-ognl/language-guide.html?spm=a1zco.8292279.0.0.791429a4We5QrK

基本原理: 工具atach到jvm进程上, 和远程debug类似 参考premain agentmain

比较有用的内容:
查看线程数
查看cpu,内存占用率

查看方法调用参数,响应时间

反编译线上代码

1. 反编译 jad的用法

下载地址
linux下载这个

命令行下面使用方式: jad -sjava xxx.class


2. 类冲突,查看类是哪个jar加载的

sc -d xxx.xxx.Xxx

3. 热修复

redefine
cglib代理过的类能替换 内部类替换
默认controller没有使用cglib代理, 在使用AOP拦截controller时会生成cglib的代理
不能新加method,field, 构造方法变更也不支持
此操作风险比较大, 只能在重启不了的情形下使用

zip替换jar中的class,然后重启

注意事项


退出使用stop shutdown, 不要使用quit exit, 终端时间过长可能自动断开, 此时JVM上的内存还在占用!!!

posted @ 2019-01-29 21:40  funny_coding  阅读(714)  评论(0编辑  收藏  举报
build beautiful things, share happiness