Online Problem Resolver Arthas
BTrace was introduced before. The use of BTrace, an online problem solving tool It's also an online problem sorter.They are all artifacts, but today this is also very powerful. It's hard to say if it's more powerful, but it's very simple to use.If you're using BTrace, you need to write the probing script in advance, upload it to the server where you need to troubleshoot, and execute the command.For example, get a method's parameters, return values, exceptions, and so on.Instead of writing scripts, Athas can be used directly from the command line, just like any tool installed on a server, such as top, jps, jmap, and so on.
The logic behind them is all byte code modifications, so if you want to understand, you can read this Java debugging tools, hot deployment, JVM monitoring tools all use it
After a long time of exaggeration, what is the magic and efficacy of Arthas?Below is an excerpt from the official introduction.
Arthas is an open source Java diagnostic tool for Alibaba and is loved by developers.
Arthas can help you solve similar problems when you are at a loss:
From which jar package did this class load?
Why are exceptions related to various classes reported?
Why did the code I changed not execute?Am I not commit?Wrong branch?
You can't debug online because you have problems. Can you only republish it by adding a log?
Online encountered a user's data processing problems, but online debug also can not be reproduced offline!
Is there a global perspective on how the system works?
What can I do to monitor the real-time running status of the JVM?
Arthas supports JDK 6+, Linux/Mac/Winodws, command-line interaction mode, and rich Tab auto-completion to further facilitate problem location and diagnosis.
See if the above description feels like discovering a new continent, and I hate to pat my thighs.I was thinking that if I knew it, I would not have blogged repeatedly for a weird online bug.
Whether you don't need it now, remember it, trust me, it will.
Installation and Startup
First remotely to the target server, then execute the following command to install and run
wget https://alibaba.github.io/arthas/arthas-boot.jar java -jar arthas-boot.jar
Arthas then lists all the Java processes on the current server.
Arthas fengzheng$ java -jar arthas-boot.jar [INFO] arthas-boot version: 3.1.1 [INFO] Found existing java process, please choose one and hit RETURN. * [1]: 95301 org.kite.CmApplication [2]: 95300 org.jetbrains.jps.cmdline.Launcher [3]: 87737 org.kite.WdApplication
For example, if you want to check for problems with the application org.kite.WdApplication Enter the number 3 and the following prompt will appear and begin to interact formally with the target application.
When formal interaction begins, it's time to kick-start and basically find the right commands for any problems that arise online.
Here are a few simple descriptions to demonstrate how to use them.
monitor
## Monitoring the overview method under the MonitorController class monitor -c 5 kite.springcloud.jxm.controller.MonitorController overview ## Monitor all methods of all classes under kite.springcloud.jxm.service package*Is a wildcard or a regular expression monitor -c 60 kite.springcloud.jxm.service.* *
-c is the execution cycle and defaults to 120 seconds, for example, -c 5 for 5 seconds and-c 60 for 60 seconds.
watch
## Print parameters before method execution watch kite.springcloud.jxm.service.MonitorDashboardService buildJvmInfo "{params}" -b -n 1 ## Print return value after method return watch kite.springcloud.jxm.service.MonitorDashboardService buildJvmInfo "{returnObj}" -s -n 1 ## Method returns to print lassLoader, class, call instance watch kite.springcloud.jxm.service.MonitorDashboardService buildJvmInfo "{loader,clazz,target}" -s -n 1 ## Printing parameters and return values for methods that take longer than 200ms watch kite.springcloud.jxm.service.MonitorDashboardService * '{params, returnObj}' '#cost>200'
trace
Method internal call path and output time-consuming on each node on the method path
trace kite.springcloud.jxm.controller.MonitorController overview # Multi-class simulation for multilink trace trace -E kite.springcloud.jxm.controller.MonitorController|kite.springcloud.jxm.service.MonitorDashboardService overview
stack
Output Call Path of Current Method Called
stack kite.springcloud.jxm.controller.MonitorController overview stack kite.springcloud.jxm.service.MonitorDashboardService overview -n 1
Detailed command introduction directly Official Documents Come on.
In addition, whether it is Arthas e or BTrace, it is used to troubleshoot single-machine service problems, that is, to apply internal code, performance issues, if you want to troubleshoot invocation issues between different services, that is another dimension.You need the help of the APM.
Don't stint on your "recommendation"
Welcome to update this series and other articles from time to time
Ancient kites, enter the public number to join the communication group