In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install and use Arthas. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Installation
Installation:
Wget https://alibaba.github.io/arthas/arthas-boot.jarjava-jar arthas-boot.jar
Execute directly under linux, and execute after window downloads the file.
After the execution is completed, the running java process in the JDK specified in the current path is displayed. Enter the corresponding sequence number and enter the sh command to indicate that the connection is successful.
Preliminary use
The initial use of the Arthas command can be divided into five categories:
Basic command
Help-- View Command help Information
Cat-- prints the contents of the file, similar to the cat command in linux
Pwd-- returns the current working directory, similar to the linux command
Cls-- clears the current screen area
Session-- to view information about the current session
Reset-- reset enhanced classes, all enhanced classes enhanced by Arthas will be restored, and all enhanced classes will be reset when the Arthas server is closed.
Version-- outputs the Arthas version number loaded by the current target Java process
History-- print Command History
Quit-- exits the current Arthas client, and other Arthas clients are not affected
Shutdown-- closes the Arthas server, and all Arthas clients exit
List of keymap--Arthas shortcut keys and custom shortcut keys
Jvm correlation
Real-time data panel of dashboard-- current system
Thread-- views the thread stack information of the current JVM
Jvm-- to view the current JVM information
Sysprop-- views and modifies the system properties of JVM
Sysenv-- views the environment variables of JVM
Getstatic-- looks at the static properties of a class
New! Ognl-- executes ognl expressions
New! Mbean-- views Mbean's information
Class/classloader correlation
Sc-- to view class information loaded by JVM
Sm-- to view method information for loaded classes
Jad-- decompilation specifies the source code of the loaded class
Mc-- memory compiler, memory interpretation. java files are .class files
Redefine-- loads external .class files and redefine them into JVM
Dump--dump has loaded the byte code of the class to a specific directory
Classloader-- to view the inheritance tree of classloader, urls, class loading information, use classloader to getResource
Monitor/watch/trace correlation
Please note that these commands are implemented through bytecode enhancement technology, and some aspects are inserted into the methods of the specified class to achieve data statistics and observation, so when online and pre-sent, please try to be clear about the classes, methods and conditions that need to be observed, and execute shutdown or enhanced classes to execute reset commands at the end of diagnosis.
Monitor-- method execution monitoring
Watch-- method performs data observation
The internal call path of the trace-- method and the output time on each node on the method path
Stack-- outputs the calling path where the current method is called
The tt-- method performs the spatio-temporal tunnel of the data, records the input parameters and return information of each call of the specified method, and can observe these different time calls.
Options
Options-- view or set Arthas global switch
Use real columns
Trace analyzes the specific execution time of each method
The figure shows that when calling the MongoTemplate.executeFindMultiInternal () method, the most time-consuming method is in the doWith () method, which is executed a total of 10000 times, with a total time of 252.3064ms. At least one call takes time = 0.0132ms, and the maximum time is 38.4329ms. The reason for the analysis is that the amount of data is too large, and MongoTemplate is serializing the results through loop traversal.
Jad decompiler code tool
Jad com.sankuai.inf.leaf.common.ZeroIDGen
Watch to view input and output parameters
Watch com.sankuai.inf.leaf.server.service.SegmentService getId'{params, target, returnObj}'- x 2
Params represents the input parameter, target represents the current class, and returnObj represents the return value.
Stack to view the called path (up)
Stack com.sankuai.inf.leaf.server.service.SegmentService getId
Sc to view class information loaded by JVM
Sc-d com.sankuai.inf.leaf.server.service.SegmentService getId
Thread Analysis deadlock
Thread b
You can see that the current thread is waiting for ReentrantLock$NonfairSync@118f1fb4, and the thread holding this object is waiting for the current thread to be released, resulting in a deadlock!
Thread Analysis of CPU occupancy
Summary
Let's start with a big picture of the official summary:
Thank you for reading! This is the end of the article on "how to install and use Arthas". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.