当前位置:网站首页>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 ;
边栏推荐
- Auto. JS learning notes 7: JS file calls functions and variables in another JS file to solve various problems of call failure
- Differences among list, set and map
- MySQL索引常见问题
- CEPH performance optimization and enhancement
- C# break continue return 三者区别
- 【云原生 | Kubernetes篇】Kubernetes 网络策略(NetworkPolicy)
- 日本经济泡沫与房价泡沫
- string类对象的访问及遍历操作
- QQ, wechat chat depends on it (socket)?
- MYSQL的最左匹配原则的原理讲解
猜你喜欢

CEPH performance optimization and enhancement

Explication du principe d'appariement le plus à gauche de MySQL

np.meshgrid()函数 以及 三维空间中的坐标位置生成 以及 numpy.repeat()函数介绍

Chained hash table

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

HALCON联合C#检测表面缺陷——仿射变换(三)

极速搭建元宇宙画廊 #oncyber.io

004:AWS数据湖解决方案

SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000

Auto. JS learning notes 7: JS file calls functions and variables in another JS file to solve various problems of call failure
随机推荐
《要领》读书笔记
The white paper "protecting our digital heritage: DNA data storage" was released
奇葩错误 -- 轮廓检测检测到边框、膨胀腐蚀开闭运算效果颠倒
How to do industry analysis
电脑启动快捷键一览表
True north reading notes
gnu-efi开发环境设置
《真北》读书笔记
使用C语言代码实现工厂端LCD RGB的测试程序
[untitled]
Auto. JS debugging: use the network mode of lightning simulator for debugging
Chained hash table
【系统分析师之路】第十八章 复盘系统安全分析与设计
Transport layer protocol -- TCP protocol
古董级MFC/GDI+框架LCD显示控件
Implementation of fruit mall wholesale platform based on SSM
C# break continue return 三者区别
Quickly build oncyber io
【926. 将字符串翻转到单调递增】
SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000