Arthas 是Alibaba開源的Java診斷工具,深受開發者喜愛
下載&啟動
wget https://alibaba.github.io/arthas/arthas-boot.jar
啟動
java -jar arthas-boot.jar
查看日志
cat ~/logs/arthas/arthas.log
Web控制台
http://127.0.0.1:8563
查看幫助
java -jar arthas-boot.jar -h
快速開始
下載demo並啟動
wget https://alibaba.github.io/arthas/arthas-demo.jar java -jar arthas-demo.jar
啟動arthas
查看dashboard
通過thread命令來獲取到arthas-demo進程的Main Class
通過jad來反編譯Main Class
退出arthas
如果只是退出當前的連接,可以用quit或者exit命令
如果想完全退出arthas,可以執行shutdown命令
文檔
https://github.com/alibaba/arthas
https://alibaba.github.io/arthas/index.html
https://alibaba.github.io/arthas/install-detail.html
https://alibaba.github.io/arthas/quick-start.html
https://alibaba.github.io/arthas/advanced-use.html
https://alibaba.github.io/arthas/commands.html
實戰演練
# 查看占CPU資源最多的前3個線程 thread -n 3 # 觀察方法執行的時候哪個子調用比較慢 trace com.xxx.cms.story.controller.product.ProductController list # 監控某個特殊方法的調用統計數據,包括總調用次數,平均rt,成功率等信息,每隔5秒輸出一次 monitor -c 5 com.xxx.cms.story.controller.product.ProductController list