当前位置:网站首页>Arthas tutorial
Arthas tutorial
2022-07-28 10:09:00 【Young--】

2.arthas-idea/ognl To configure
need idea Installing a plug-in arthas-idea
3. Use ognl Call method complex parameters ( You need to configure )
arthas-idea help 
1 thread
thread -n 3/ Support one click display of the busiest previous 3 Thread and print stack
thread/ The default in accordance with the CPU Incremental time descending order , Display only the first page of data
thread –all/ Show all matching threads
thread -b/ Find out which threads are currently blocking other threads
thread -i 1000/ Count the recent 1000ms Threads inside CPU Time .
thread -n 3 -i 1000/ List 1000ms The busiest in the world 3 A thread stack
thread –state WAITING/ View threads in the specified state (WAITING/ wait for )
2 memory see JVM Memory information
memory/ see JVM Memory information
3 sysprop View the current JVM System properties of
sysprop/ See all the properties
sysprop java.version/ View individual properties ( Supported by TAB Key auto completion )
sysprop user.country CN/ Modify individual properties ( take user.country Modified into CN)
4 sysenv View the current JVM Environmental attributes of
sysenv/ View all environment variables
sysenv USER/ Look at a single environment variable
5-6 (vmtool,ognl) Complex parameter processing .
@[email protected]("{\"username\":\"y1y1\",\"password\":\"y1\"}",@[email protected])
5 vmtool vmtool utilize JVMTI Interface , Implementation call interface , Query memory objects , mandatory GC And so on 
You can get spring Any object of
//vmtool -x 3 --action getInstances --className com.yjx.cloud.user.controller.api.ApiAppUserLoginController --express 'instances[0].appLogin(@[email protected]("{\"username\":\"y1y1\",\"password\":\"y1\"}",@[email protected]))' -c 9e89d68
6 ognl perform ognl expression 
ognl -x 3 '#[email protected][email protected],#springContext.getBean("apiAppUserLoginController").appLogin(@[email protected]("{\"username\":\"y1y1\",\"password\":\"y1\"}",@[email protected]))' -c 9e89d68
7 watch You can easily observe the call of the specified function . The range that can be observed is : Return value 、 Throw an exception 、 Enter the reference , By writing OGNL Expression to view the corresponding variable . watch See adding some default parameters , such as -x 3 an 3 The layer data

8 trace Method internal call path , And output the time consumption of each node on the method path 
9 stack Output the call path of the current method to be called 
10 monitor Method execution monitoring 
Monitoring item explain
timestamp Time stamp
class Java class
method Method ( Construction method 、 Common method )
total Call the number
success Number of successes
fail Number of failures
rt Average RT
fail-rate Failure rate
11 jad Decompile class become java file 
12 arthas Hot deployment processing 
Save the data copied above to xxx.sh, Then go to the server to execute , Will automatically enter arthas Selection service process , Select the corresponding to class Thermal deployment
Other useful commands
•jad: Decompile a function , Generally, when there is a problem with the online code , See if it is when the code is released , Wrong version selected ; jad Class full name wildcard Function name ( Optional ) --lineNumber( According to the line Numbers )
•sc: View the loaded class information , This command is used when the bytecode is modified by a third party , Particularly useful sc Class full name wildcard Function name wildcard -d( details ) -f( Output class member variable information ) -E( Turn on regular matching )
•dashboard: Real time data panel of current system , Press ctrl+c sign out
•monitor: Method execution monitoring , Like every other 5 Count the execution times of a method in seconds , You can also execute input filter conditions monitor -c 5 -E( Turn on regular matching ) Class full name wildcard Function name wildcard “params[0] <= 2”
•thread: View the current thread information , Look at the stack of threads , Such as thread -n 3
•jvm: View the current JVM Information
•sysprop: View the current JVM System properties of (System Property)
•sysenv: View the current JVM Environmental attributes of (System Environment Variables)
•vmoption: see , to update VM Diagnosis related parameters , Such as vmoption PrintGCDetails
•perfcounter: View the current JVM Of Perf Counter Information
•logger: see logger Information , to update logger level
•mbean: see Mbean Information about , This command can easily view or monitor Mbean Attribute information .
•getstatic: Direct use is recommended ognl command , More flexible . adopt getstatic Command can easily view the static properties of a class .
•ognl: perform ognl expression , Such as calling static functions :ognl ‘@[email protected](“hello”)’
, Get static fields :ognl ‘@[email protected]’
•sm: View method information for loaded classes , This command can search out all loaded Class Information method information .
•dump:dump The... Of the class has already been loaded bytecode Go to a specific directory , Such as dump -d /tmp/output java.lang.String
•heapdump:dump java heap, similar jmap Ordered heap dump function .
•classloader: see classloader Inheritance tree of ,urls, Class loading information ,classloader The order will JVM All of the classloader Statistics of the information , And you can show the inheritance tree ,urls etc. .
•mc:Memory Compiler/ Memory compiler , compile .java File generation .class.
•retransform: Load external .class file ,retransform jvm Loaded classes .retransform /tmp/Test.class
, adopt -d Parameter delete external class , adopt –deleteAll Delete all external classes
•redefine: Recommended retransform command ,redefine Command and jad/watch/trace/monitor/tt Waiting for orders to conflict . After execution redefine after , If you execute the above command again , It will put redefine Bytecode reset for . as a result of jdk In itself redefine and Retransform It's a different mechanism , Use both mechanisms to update bytecode , Only the last changes will take effect .
•trace: Method internal call path , And output the time consumption of each node on the method path ,trace Command can actively search class-pattern/method-pattern The corresponding method call path , Render and count all performance overhead and trace call links on the entire call link .
•stack: Output the call path of the current method to be called , A lot of times we know that a method is executed , But this method has a lot of paths to execute , Or you don't even know where this method was implemented , What you need at this time is stack command .
•profiler: Use async-profiler Generate flame chart ,profiler The command supports the generation of flame diagrams of application hotspots . Essentially through continuous sampling , Then the collected sampling results are generated into a flame diagram .
•cat: Print file contents , and linux Inside cat Command similar .
•base64:base64 Encoding conversion , and linux Inside base64 Command similar .
•tee: Similar to traditional tee command , Used to read standard input data , And output its content to a file .tee Instruction data from the standard input device , Output its contents to the standard output device , At the same time save it as a file . Such as :sysprop | tee -a /path/to/logfile | grep java
•auth: Verify the current session , stay attach when , You can specify a password on the command line .
13 Application startup time analysis


start-up arthas Then select the corresponding service
Start by interrupting 
profiler start --event cpu --interval 10000000

Let go of idea The breakpoint execution of spring Execute after startup
profiler stop --format html

Will generate a html file , Open it with a browser Analyze
The results are as follows , This diagram is commonly known as flame diagram , It mainly depends on the horizontal axis length of each method , The longer the abscissa is occupied , What it occupies cpu It's the longest , It's very intuitive 
14 idea View the current Dump You can see the current occupation cup The long way 
边栏推荐
猜你喜欢

13 probability distributions that must be understood in deep learning

Seektiger eco pass STI new progress, log in to ZB on April 14
![[OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)](/img/0c/2e8290403d64ec43d192969f776724.png)
[OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)

小黑重新站起来看leetcode:653. 两数之和 IV - 输入 BST

Installing MySQL for Linux operating system (centos7)

OSPF的拓展配置,选路原则,防环及重发布

OSPF的LSA及优化

Digital construction of pharmaceutical industry is on the verge

高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练

关于软考高级要不要报班学习
随机推荐
【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03
Take you to wechat applet development in 3 minutes
Plato farm - a farm meta universe game with Plato as the goal
PlatoFarm进展不断,接连上线正式版以及推出超级原始人NFT
Time series analysis 41 - time series prediction tbats model
工业品MRO采购网站有哪些优势?一文带你读懂
在Plato Farm新经济模型下,如何在游戏中获取更多MARK
【JZOF】15二进制中1的位数
Plato Farm-以柏拉图为目标的农场元宇宙游戏
MySQL 为什么有时候会选错索引?
ConsoleAppender简介说明
PHP 基础
Software testing and quality learning notes 2 - black box testing
CloudCompare&PCL 匹配点采样一致性抑制
(10) Defer keyword
2022-uni-app解析token标准的方式-使用jsrsasign-爬坑过了
The victory of Dao community, tiger Dao VC wins in governance and consensus
备受关注的Bit.Store,最新动态一览
Today, I want to talk about the data types of MySQL database
In the era of home health diagnosis, Senzo creates enhanced lateral flow test products