当前位置:网站首页>JVM (III) Virtual machine performance monitoring & fault handling tool
JVM (III) Virtual machine performance monitoring & fault handling tool
2022-06-12 10:02:00 【A god given dream never wakes up】
JVM ( 3、 ... and ). Virtual machine performance monitoring & Troubleshooting tools
1. summary
System positioning problem , Tools are needed to export the data in question ; The data here has an exception stack , Virtual machine log , Garbage collection log , Thread snapshot , Heap snapshot file ; There are many tools, such as the tools provided by the virtual machine or the third-party parsing tools ;
2. Basic tools
In the catalog JAVA_HOME/bin/ Inside

2.1 jps
jps: (JVM Precess Status) Virtual machine process health tool : List the running virtual machine processes , And display the main class ;
jps Command format :
jps [options] [hostid]
| Options | effect |
|---|---|
| -q | Only the output LVMID Omit the name of the main class |
| -m | To main class mian() Method parameters |
| -l | Full name of main class , If it is jar package It is jar Package address |
| -v | Startup time JVM Parameters |
[[email protected] ~]# jps -q
1424
129685
77724
1742
[[email protected] ~]# jps -m
1424 QuorumPeerMain /package/zookeeper/bin/../conf/zoo.cfg
129700 Jps -m
77724 KafkaEagle start
1742 Kafka config/server.properties
[[email protected] ~]# jps -l
1424 org.apache.zookeeper.server.quorum.QuorumPeerMain
129712 sun.tools.jps.Jps
77724 org.apache.catalina.startup.KafkaEagle
1742 kafka.Kafka
[[email protected] ~]# jps -v
1424 QuorumPeerMain -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -Dcom.sun.management.jmxremote -Dcom.sun.management.j
mxremote.local.only=false129725 Jps -Denv.class.path=.:/usr/local/jdk/jdk1.8.0_51//lib/tools.jar:/usr/local/jdk/jdk1.8.0_51//lib/dt.jar: -Dapplication.home=/
usr/local/jdk/jdk1.8.0_51 -Xms8m77724 KafkaEagle -Djava.util.logging.config.file=/package/kafka-eagle/kms/conf/logging.properties -Djava.util.logging.manager=org.ap
ache.juli.ClassLoaderLogManager -Xmx1g -Xms1g -XX:MaxGCPauseMillis=20 -XX:+UseG1GC -XX:MetaspaceSize=128m -XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80 -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -Dcatalina.base=/package/kafka-eagle/kms -Dcatalina.home=/package/kafka-eagle/kms -Djava.io.tmpdir=/package/kafka-eagle/kms/temp1742 Kafka -Xmx1G -Xms1G -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent
-Djava.awt.headless=true -Xloggc:/package/kafka/bin/../logs/kafkaServer-gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=7788 -Dkafka.logs.dir=/package/kafka/bin/../logs -Dlog4j.configuration=file:./bin/../config/log4j.properties
2.2 jstat
jstat: JVM Statistics Monitoring Tool : Command line tool for monitoring virtual machine running status information
jstat Command format :
jstat [option vmid [interval[s|ms] [count]]
| Options | effect |
|---|---|
| -class | Class information loaded by virtual machine |
-gc | Heap information detection Garbage collection information |
-gcutil | -gc The information is about the same Percentage form |
-gccause | The last time gc reason |
| ... | .... |
[[email protected] ~]# jps -l
1424 org.apache.zookeeper.server.quorum.QuorumPeerMain
3512 sun.tools.jps.Jps
77724 org.apache.catalina.startup.KafkaEagle
1742 kafka.Kafka
[[email protected] ~]# jstat -gc 1424 100 10 // 1424 pid 100ms once in total 10 Time
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 6986.6 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 7055.9 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 7055.9 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 7055.9 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
512.0 512.0 512.0 0.0 15360.0 7074.3 20480.0 5191.8 11008.0 10679.9 1280.0 1198.4 58 2.944 0 0.000 2.944
[[email protected] ~]# jstat -gcutil 1424 100 10
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
100.00 0.00 47.29 25.35 97.02 93.63 58 2.944 0 0.000 2.944
2.3 jinfo
jinfo: Configuration Info for Java : View and adjust various parameters of virtual machine in real time
jinfo Command format :
jinfo [option ] pid
[[email protected] ~]# jinfo 1424
Attaching to process ID 1424, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.51-b03
Java System Properties:
java.runtime.name = Java(TM) SE Runtime Environment
java.vm.version = 25.51-b03
..........
VM Flags:
........
2.4 jmap
jmap:Memery Map for Java : Heap memory snapshot heapdump /dump
jmap Command format :
| Options | effect |
|---|---|
| -dump | Generate a heap snapshot |
-finallizerinfo | F-Queue Information |
-heap | Linux It works Java Heap information |
-histo | Statistics of objects in the heap Number of class instances , Aggregate capacity |
| -F | -dump When there is no response Force generation |
C:\Users\sff>jmap -dump:format=b,file=test.bin 19140
Dumping heap to C:\Users\sff\test.bin ...
Heap dump file created
2.5 jhat
jhat: JVM Heap Analysis Tool : Resolve heap memory snapshot dump file
jhat Command format :
jhat [ file ]
C:\Users\sff>jhat test.bin
Reading from test.bin...
Dump file created Sun Jan 23 22:32:09 CST 2022
Snapshot read, resolving...
Resolving 118891 objects...
Chasing references, expect 23 dots.......................
Eliminating duplicate references.......................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.
Access address : http://localhost:7000/
2.6jstack
jstack: Stack Trace for Java : Generate a snapshot of the current virtual machine thread
jstack Command format :
jsatck [option] pid
| Options | effect |
|---|---|
| -F | Output does not respond Forced response |
| -l | Except for the stack And lock information |
| -m | When it comes to local methods You can also show C/C++ |
2.7 Other commands
| command | effect |
|---|---|
java | Run the command function Class Documents or jar package |
javac | Compiler tools |
javap | Bytecode analysis tool Decompile |
3. Visual fault handling tool
3.1 JConsole
Java Monitoring and Management ConsoleJava Monitoring and management console ; be based on JMX Visual tools , adopt JMX management MBean;
adopt pid Or the class name is connected to the service you want to see running JVM situation

Mainly : Memory monitoring Memory usage of each area of the virtual machine GC situation ; Thread monitoring is a bit like jstack, There is also deadlock detection below

3.2 VisualVM
All-in-One Java Troubleshooting Tool It is one of the most powerful operation monitoring and fault handling programs , For a long time Oracle Official failure handling tools for virtual machines
If the computer is configured with environment variables ; Direct input jvisualvm You can open it directly , Connect your own application , View the application running JVM The state of ; There are also many plug-ins with rich functions ;

3.3 MAT
Eclipse Of Memory Analyzer Tool (MAT); Personal use is still more , General users view the problem of memory leakage ; Load memory snapshot directly , Click the object that occupies more memory ;
边栏推荐
- np.meshgrid()函数 以及 三维空间中的坐标位置生成 以及 numpy.repeat()函数介绍
- MYSQL的最左匹配原則的原理講解
- C语言递归文件夹的代码
- 哈希表的线性探测法代码实现
- The Dragon Boat Festival is in good health -- people are becoming more and more important in my heart
- Transport layer protocol -- TCP protocol
- 存储研发工程师招聘
- 《真北》读书笔记
- 六月集训(第12天) —— 链表
- Li Yang, a scientific and technological innovator and CIO of the world's top 500 group: the success of digital transformation depends on people. Decision makers should always focus on "firewood"
猜你喜欢

gnu-efi开发环境设置

科创人·世界500强集团CIO李洋:数字化转型成事在人,决策者应时刻聚焦于「柴」

科创人·神州数码集团CIO沈旸:最佳实践模式正在失灵,开源加速分布式创新

C 语言仅凭自学能到什么高度?

How CEPH improves storage performance and storage stability

Auto.js学习笔记4:autojs打包后,大部分华为等大牌子手机无法安装?利用模拟器远程在autoPro里签名打包可以解决该问题。

Auto. JS learning note 4: after autojs is packaged, most Huawei and other big brand mobile phones cannot be installed? This problem can be solved by using the simulator to remotely sign and package in

【clickhouse专栏】基础数据类型说明

软件定义存储概览(一篇就够)

《真北》读书笔记
随机推荐
7-5 zhe zhe playing games
Auto. JS learning note 9: basic methods such as using the script engine, starting the script file with the specified path, and closing
奇葩错误 -- 轮廓检测检测到边框、膨胀腐蚀开闭运算效果颠倒
GNU EFI development environment settings
[cloud native | kubernetes] kubernetes networkpolicy
5种最常见的CEPH失败方案
string类对象的访问及遍历操作
2022 pole technology communication - the dispute over anmou technology is settled, and the cornerstone of the local semiconductor industry is more stable
存储研发工程师招聘
Jetpack architecture component learning (3) -- activity results API usage
Ceph如何改善存储性能以及提升存储稳定性
C# break continue return 三者区别
7-13 地下迷宫探索(邻接表)
7-4 network red dot punch in strategy (DFS)
Jetpack架构组件学习(3)——Activity Results API使用
June training (day 12) - linked list
链式哈希表
总有一根阴线(上影线)会阻止多军前进的脚步,总有一个阳线(下影线)会阻挡空军肆虐的轰炸
Research on autojs wechat: the control IP in wechat on different versions of wechat or simulators is different.
postgresql 使用存储过程,拼接多张表,查询数据