53

爱上Java诊断利器之Arthas

 4 years ago
source link: https://www.tuicool.com/articles/ueE3yaq
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

1.Arthas是什么?

摘自Arthas的Github介绍:

Arthas is a Java Diagnostic tool open sourced by Alibaba.
Arthas allows developers to troubleshoot production issues for Java applications without modifying code or restarting servers.

大意为:Arthas是阿里开源的一个Java诊断工具,可以帮助开发人员在不修改代码或重启服务器的情况下快速定位线上问题。

听起来确实是我们的程序员的一大福利。比如,我们就遇到一种情况,Spring Boot应用中有个cron定时任务为每天凌晨1点启动执行,但是测试起来很不方便,总不能每次修改cron时间来让QC测试吧?这样虽然是方便了测试妹子,但是却徒增了我们开发时间和迭代次数啊!!!那Arthas到底是否能够满足我们需求呢?Go on…

2.开启Arthas之旅

2.1安装Arthas

  • 方式1:下载arthas-boot.jar包的方式
wget https://alibaba.github.io/arthas/arthas-boot.jar

此时在你当前所在目录下会有个 arthas-boot.jar 包。

VZbqmuq.png!web

尝试下arthas:

# 启动arthas,会进入命令行交互状态
java -jar arthas-boot.jar

# 查看arthas命令手册
java -jar arthas-boot.jar -h

VvMNF3E.png!web

  • 方式2:通过as.sh安装Arthas( 强烈推荐
curl -L https://alibaba.github.io/arthas/install.sh | sh

j26f6jv.jpg!web 一个正在技术专家成长道路上不断努力前进的程序员

(转载本站文章请注明作者和出处buildupchao)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK