当前位置:网站首页>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 
边栏推荐
- [ESP32][esp-idf][LVGL7.9] 使用oled iic编译失败
- [OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)
- 医药行业数字化建设,箭在弦上
- Platofarm has made continuous progress, and has launched the official version and super primitive NFT successively
- Sizebasedtriggingpolicy introduction
- matlab特征点提取--记录自用
- OSPF的不规则区域,LSA和序列号
- 腾讯技术专家:解密亿级用户产品 微信、QQ、王者荣耀...全面上云实践!
- j s的数组方法,循环
- Bit.store, which has attracted much attention, is at a glance of the latest developments
猜你喜欢

Being on duty less than 8 hours a day and being dismissed? Tencent's former employees recovered 13million overtime pay, etc., and the court won a compensation of 90000 in the final judgment

Extreme deflation and perpetual motion machine model will promote the outbreak of platofarm

居家健康诊断时代下,Senzo打造增强侧向流测试产品

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

Installing MySQL for Linux operating system (centos7)
Edge team explains how to improve the comprehensive performance experience through disk cache compression technology

【JZOF】14剪绳子

Time series analysis 41 - time series prediction tbats model

TCP 基础知识

深度学习必懂的 13 种概率分布
随机推荐
In the era of home health diagnosis, Senzo creates enhanced lateral flow test products
Edge team explains how to improve the comprehensive performance experience through disk cache compression technology
Take you to wechat applet development in 3 minutes
Array method of J S, loop
(十)defer关键字
Array collation commonly used in PHP
Being on duty less than 8 hours a day and being dismissed? Tencent's former employees recovered 13million overtime pay, etc., and the court won a compensation of 90000 in the final judgment
Espresso systems, which has just obtained financing, has both intellectual property rights and team ethics in trouble
PHP7 中 ?? 与? :的区别
深度学习必懂的 13 种概率分布
总线相关概念集合
这种动态规划你见过吗——状态机动态规划之股票问题(中)
Tencent technical experts: decrypt the 100 million user products wechat, QQ, King glory... Comprehensively practice on the cloud!
PHP 基础
Install lamp under deepin
Several innovative economic models of platofarm have inspired the current metacosmic market
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 2)
Seektiger eco pass STI new progress, log in to ZB on April 14
备受关注的Bit.Store,最新动态一览
Software testing and quality learning notes 2 - black box testing