Java
Arthas
Arthas allows developers to troubleshoot production issues for Java applications without modifying code or restarting servers. It is the opensource develop by Alibaba.
Install
wget https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar
# From web
java -jar arthas-boot.jar --target-ip 100.20.30.40 --telnet-port 3658 19113
Usage
Input number to select the java application to trace.
[INFO] JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64
[INFO] arthas-boot version: 3.6.7
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 2115602 /root/service/app/bitdove/hawkbit-update-server-0.3.0-SNAPSHOT.jar
[2]: 2115603 /root/service/app/bitdove/hawkbit-device-simulator-0.3.0-SNAPSHOT.jar
CLI
# List all command
help
# Monitor
dashboard
# Exit looping command
q
# List thread
thread
# List the stack of top 3 threads with CPU usage
thread -n 3
# List thread by pid
thread $PID
# Find class load by JVM
sc -d *Thread
# Decompile code in JVM
jad $CLASS_FULL_NAME
# View method information
watch
# Exit
exit
quit