当前位置:网站首页>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 
边栏推荐
- Holy Grail of web and double wing layout, float, clear, both
- j s的数组方法,循环
- 2022-uni-app解析token标准的方式-使用jsrsasign-爬坑过了
- In the era of home health diagnosis, Senzo creates enhanced lateral flow test products
- Introduction to thresholdfilter
- OSPF expansion configuration, routing principles, anti ring and re release
- 哪些字符串会被FastJson解析为null呢?
- OSPF的LSA及优化
- [esp32][esp idf] esp32s3 quickly build lvglv7.9
- 初学C#必须要掌握的基础例题
猜你喜欢

建筑建材行业B2B电子商务网站方案:赋能建材企业转型升级,实现降本提效

工业品MRO采购网站有哪些优势?一文带你读懂

2021.07.13 我们是这样崩的

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

Flink - checkpoint Failure reason: Not all required tasks are currently running

13 probability distributions that must be understood in deep learning

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

pkg打包node工程

arthas使用教程

JS提升:实现flat平铺的底层原理
随机推荐
Installing MySQL for Linux operating system (centos7)
PHP 基础
Introduction to timebasedrollingpolicy
Judge whether the string is palindrome
【JZOF】15二进制中1的位数
LSA and optimization of OSPF
初学C#必须要掌握的基础例题
PlatoFarm几大创新经济模型,给予当下元宇宙市场的启发
The blind box of super primitive series will be launched soon, and platofarm will enable more rights and interests
Array collation commonly used in PHP
LinkedList源码按摩,啊舒服
TimeBasedRollingPolicy简介说明
Illustrate three mainstream enterprise architecture models (recommended collection!)
PHP Basics
深度学习必懂的 13 种概率分布
In the era of home health diagnosis, Senzo creates enhanced lateral flow test products
【MySQL】查询多个ID返回字符串拼接
Weekly report on July 27, 2022
居家健康诊断时代下,Senzo打造增强侧向流测试产品
二分、三分、01分数规划 【第I弹】