How to use Arthas-Java diagnostic tool gracefully

Official website address: https://arthas.aliyun.com/en-us/
Note: The demonstration here is demonstrated with the idea plugin

1. Idea install the arthas idea plugin

Insert picture description here
Click quick start,

click IDEA Plugin
Insert picture description here
idea to install the arthas idea plugin

2. Download arthas-boot.jar and allow, choose to specify java instance

curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar

Insert picture description here

Three, view the attribute value of the object in the running java instance


After clicking, the command is
getstatic com.ctrip.wingon.frbs.common.GcHelper OS -x 3 The
execution effect is as follows
Insert picture description here

Fourth, the input and output of the monitoring function and exceptions

Insert picture description here
The command after clicking is
watch com.ctrip.wingon.frbs.common.GcHelper tryFullGc'{params,returnObj,throwExp}' -v -n 5 -x 3 '1==1' The
execution effect is as follows, you can clearly see the input , Output, abnormal index
Insert picture description here

Five, performance tracking

Insert picture description here
After clicking, the command is
trace com.ctrip.wingon.frbs.common.GcHelper tryFullGc -v -n 5 --skipJDKMethod false '1==1' The
execution effect is as follows, you can clearly see where the performance bottleneck is
Insert picture description here

to sum up

There are also viewing jvm information, generating headdump files, viewing stack information, data statistics, and so on. It is not shown here that
by using arthas, you can easily locate whether the code in production is executed or not. The execution value is How much, where is the performance bottleneck, what is the jvm information, etc.

Guess you like

Origin blog.csdn.net/qq_33594101/article/details/109383973