当前位置:网站首页>Arthas, a sharp tool for online diagnosis - several important commands
Arthas, a sharp tool for online diagnosis - several important commands
2022-06-25 15:24:00 【Running pig ZC】
Catalog
3: A detailed explanation of common orders
1: Write in the front
Are you still worried about online problems ?
Are you still upset that there is no print log online and the log is republished again ?
Are you still suffering from the headache of working inefficiently for some reason ?
Next, we will introduce an open-source online diagnostic tool from Alibaba --Arthas. After my own test, the leather is really , Love the , Love the .
2: install
At present, only for macos perhaps centos Environmental Science , Installation steps
1: Use wget https://alibaba.github.io/arthas/arthas-boot.jar Download
2: Use java -jar To start the jar java -jar arthas-boot.jar

3: Select the previous 1,2,3 Conduct attach To the corresponding app in , Like mine here app yes ArthasTestApplication, So I choose 3, And then go back

In this way, it is easy to enter arthas The connection corresponds to app The interface of .
3: A detailed explanation of common orders
3.1:jvm
You can see the current jvm Some of the parameters in it , Including important indicators ,GC The number and time of , Not the point of this article

3.2:trace ( Time consuming )
grammar :trace Fully qualified class name Method name =======> trace com.zcc.arthastest.TestController getUser
You can view the call stack of the primary interface , Which interfaces take more time , At present, the official style is marked with red .

Obviously in the screenshot , This method is used 3003.885282 It takes a lot of time , And in #19 That's ok , I found that thread hibernation occurred in the code , This shows that you can optimize .
3.3:watch( View parameters )
For us, there is no online reference , Return parameters , The exception thrown , Where is it excluded , And then he looked confused , Do you have 10000 drafts in mind , Now don't panic , A few simple commands can help you solve the problem easily .
1: Check the input parameters
watch -b Fully qualified class name Method name params =======> watch -b com.zcc.arthastest.TestController getUser params

In the screenshot, it is obvious that the intercepted input parameters have been typed
2: View output parameters
command :watch Fully qualified class name Method name "{params, returnObj, throwExp}" ====== >
watch com.zcc.arthastest.TestController getUser "{params, returnObj, throwExp}"

3: View outliers
The command is the same as that of the view parameter , The following is a direct demonstration , When the input parameter ==1 When , It throws an exception
watch Fully qualified class name Method name "{params, returnObj, throwExp}" ====== >
watch com.zcc.arthastest.TestController getUser "{params, returnObj, throwExp}"

3.4:stack
View the call stack and java Kit comes with jstack It's about the same , Is to view the call stack of the thread .
command :stack Fully qualified class name Method name =======> stack com.zcc.arthastest.TestController getUser

3.5:tt
tt -t com.zcc.arthastest.TestController getUser
You can also add -n Parameters
tt -t -n 3 com.zcc.arthastest.TestController getUser Three times will exit , Prevent too many calls , It's hard to find
The legendary time and space tunnel , You can view the record of interface calls , And replay , This is really too fierce .

Interface playback :
1: First use tt -l Look at the list

2: Select a index To play back
command : tt -i 1000 -p
The playback index = 1000 Of

The playback index = 1010 Of

4: summary
Only this and nothing more Arthas This is the brief introduction of , Under the supplement , Now many companies basically use docker Or based on docker The deployment of , Actually Arthas That's one jar nothing more , Put it completely in dockerFIle To build a container together , Otherwise, you have to download it again every time you release it , This is embarrassing , This jar Not much , The cost is not very high . As long as DockerFile Add a line of code to --- Lu Xun told you that big trees can enjoy the cool , But I didn't tell you how to find the big tree . If there are any bad points in the above, please guide and exchange .
4: The attachment
This chapter tests the code address :https://gitee.com/htmonitor/arthas.git
边栏推荐
- p1408
- Vs2019 scanf error
- 2.18 codeforces supplement
- 55 specific ways to improve program design (2)
- [paper notes] overview of case segmentation
- A deformation problem of Hanoi Tower
- One code per day - day one
- The difference between sizeof and strlen
- [paper notes] contextual transformer networks for visual recognition
- [paper notes] semi supervised object detection (ssod)
猜你喜欢

Shared memory synchronous encapsulation

Several common optimization methods

Data preprocessing - normalization and standardization

System Verilog - thread

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat

How to combine multiple motion graphs into a GIF? Generate GIF animation pictures in three steps

Dynamic memory allocation
![[paper notes] contextual transformer networks for visual recognition](/img/e4/45185983e28664564bbf79023ccbf6.jpg)
[paper notes] contextual transformer networks for visual recognition

Source code analysis of zeromq lockless queue

Sequential programming 1
随机推荐
Advertising effect cluster analysis (kmeans)
Several common optimization methods
Esp8266 building smart home system
Single user mode
GDB debugging
Usage of pure virtual functions
Qt: Pro project file
Qcodeeditor - QT based code editor
2. operator and expression multiple choice questions
Introduction to flexible array
Leetcode122 timing of buying and selling stocks II
RDB and AOF persistence of redis
2.18 codeforces supplement
Study notes of cmake
Common classes in QT
System Verilog - function and task
C language LNK2019 unresolved external symbols_ Main error
QT set process startup and self startup
Qlogsystem log system configuration use
System Verilog - data type