This article only tests and studies the Arthas command and does not discuss the Arthas principle. If you are interested in Arthas, please click on the link to the Meituan blog below.
A link to the
Arthas Chinese official website
Meituan blog about Java dynamic tracking an article, explains part of the principle, recommended reading
Official command reference manual
introduce
What is arthas? What can be done?
Here is a copy of the official document to tell you.
Arthas is an open source Java diagnostic tool for Alibaba that developers love.
Arthas can help you when you are stuck with a problem like the following:
- From which JAR is this class loaded? Why are all kinds of class-related exceptions reported?
- Why didn’t the code I changed execute? Did I not commit? Got the branch wrong?
- If you encounter a problem, you cannot debug it online. Can you only re-publish it by logging?
- There is a problem with a user’s data processing online, but it cannot be debugged online, and it cannot be reproduced offline!
- Is there a global view of the health of the system?
- Is there any way to monitor the real-time health of the JVM?
Arthas supports JDK 6+, Linux/Mac/ Windows, command line interaction, and rich Tab auto-completion to further locate and diagnose problems.
The installation
Recommended use:
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
Copy the code
Select an already running Java process.
You can then access the arthas command line or choose to open 127.0.0.1:8563 in your browser and log in to the webUI.
function
dashboard
You can view memory information for the current JVM as well as thread information.
thread
Use thread 1 to view the stack information for a specific thread (the following number is the thread ID).
jad
Decomcompiling a class,jad Demo. MathGame, prints out the decomcompiled source code at the command line.
watch
The watch command is used to continuously observe the return value of a method.
watch demo.MathGame primeFactors returnObj
Copy the code
exit
Run the exit/quit command to exit temporarily and continue the connection later.
Use the shutdown command to completely disconnect and reset the class file.
sc,sm
View the corresponding class loading information and method loading information.
trace
View the internal invocation path of the method and return the elapsed time for each node.
stack
Prints the call path to which the current method is called
To the end.
ChangeLog
All the above are personal thoughts, if there is any mistake welcome to comment.
Welcome to reprint, please sign and keep the original link.
Contact email: [email protected]
For more study notes, see my personal blog ——>HuYan ten