当前位置:网站首页>Jstat of JVM command: View JVM statistics
Jstat of JVM command: View JVM statistics
2022-07-07 06:00:00 【Zhang Junjie 1994】
Study Silicon Valley Song Hongkang JVM From entry to mastery Learning notes of
summary
Basic grammar
among vmid Is a process id Number , That is to say jps And then you see the number in front of you , as follows :
option Parameters
-gc
Cenozoic related
S0C It's the size of the first survivor zone ( byte )
S1C It's the size of the second survivor zone ( byte )
S0U It's the size of the first survivor zone used ( byte )
S1U Is the size of the second survivor zone that has been used ( byte )
EC yes Eden The size of the space ( byte )
EU yes Eden Space used size ( byte )
Older generation related
OC It's the size of the old days ( byte )
OU It's the size used in the old days ( byte )
Method area ( Meta space ) relevant
MC It's the size of the method area
MU Is the used size of the method area
CCSC Is the size of the compressed class space
CCSU Is the used size of the compressed class space
other
YGC From application startup to sampling young gc The number of times
YGCT It's from the start of the application to the time of sampling young gc Elapsed time ( second )
FGC From application startup to sampling full gc The number of times
FGCT From application startup to sampling full gc Time consuming ( second )
GCT From application startup to sampling gc The total time of
interval Parameters
Used to specify the period of output statistics , The unit is millisecond . namely : Query interval
count Parameters
Used to specify the total number of queries
-t Parameters
You can add a... Before the output Timestamp Column , Display the running time of the program . Company : second
We execute jstat -gc -t 13152 1000 10, This represents 1 Seconds to print out 1 That's ok , altogether 10 That's ok ,-t The representative prints out Timestamp Total operation time , The results are shown below :
The red box above represents Timestamp, The blue box represents the garbage collection time , The units are seconds , If you subtract two values in the red box , Suppose this value is num1, Then subtract the other two values in the blue box of the corresponding row , Suppose this value is num2, Then let num2/num1, The difference obtained is the above GC Time as a percentage of running time
Although this method is cumbersome , But after the project is deployed, you need to use the command line to see , There is no visual interface , So this way should also
-h Parameters
When periodic data is output , How many lines of data to output and then output a header information
demonstration
Start the above program
Enter the following command
Loaded Is the number of loaded classes
first Bytes Is the number of bytes occupied by the loaded class
Unloaded Is the number of unloaded classes
the second Bytes Is the number of bytes occupied by the unloaded class
Time Is the time spent loading classes
The parameters of the arrow are interval Parameters ,
The arrow means 1 Print every second , For our continuous monitoring . Will always print , It won't print until the program is over .
The parameter of the arrow is the number of times to print ,10 It means that a total of 10 Time , achieve 10 Printing will stop after times .
-t Output means output How long has it taken since the program was running until now when you hit the command , The unit is seconds
Timestamp This is the time
-h3 It means that the table header is output every three records
compiler Is to display the compiled method , Time consuming compiled methods , Methods of compilation failure, etc
Print the compiled method
s0c Survivor 0 Area capacity
s1c Survivor 1 Area capacity
sou Survivor 0 The capacity that the zone has used
s1u Survivor 1 The capacity that the zone has used
ec The total capacity of Eden Park
eu Capacity used in Eden Park
oc It's the total amount of the old age
ou It is the capacity used in the old age
mc Is the capacity of the method area
mu Is the capacity used by the method area
ccsc Is the total number of compressed classes
ccsu Is the usage capacity of the compressed class
ygc yes young gc Parameters that occur
tgct yes young gc Time spent
fgc yes full gc Parameters of
fgct yes full gc Time spent
gct It's total gc Time for , total gc Time spent =young gc Time spent +full gc Time spent
jstat: How to check OOM And memory leaks
At ordinary times, you can use some graphical interface tools to view , But in the actual production environment , You may not be able to use these graphical interface tools , It can only be used jdk Self contained jstat The tool checks and monitors .
Start this main Method
Be careful , When executing the above command, it does not throw oom abnormal , And then back Java The program console throws this exception .
appear gc Why
oom Troubleshooting experience :
Experience :
We can compare Java The start time of the process and the total gc Time for (gct Column ), Or the interval between two measurements and the total gc The increment of time ( perform gc How long did it take ), Come out of gc The proportion of execution time in program running time .
The data between the above two red boxes gct The sum of time Divide The data between the above two red boxes Timestamp The sum of time , To get the ratio of garbage collection time to the total time of program execution
If this ratio exceeds 20%, It means that the current reactor pressure is high , Because garbage collection takes a little more time , If this ratio exceeds 90% 了 , That means that the execution time of the program is percent 90 All the time is spent on garbage collection , It shows that there is basically no memory space , Then it may appear at any time oom Abnormal .
use jstat Identify memory leaks
Add
The first 1 Step can execute commands :jstat -gc -t 13152 1000 20
Observe every once in a while ou Parameters , If ou Parameters ( Memory usage in old times ) The occupation of is getting higher and higher , This situation is that objects that cannot be recycled in the old age are growing , You have to think about it , Why? gc These objects are not cleaned up , It is estimated that there may be a memory leak .
jstatd: Remote host information collection
Because the data we want to monitor is not necessarily local , A lot of data to be monitored is online linux Upper , You need to use jstatd This tool is used for remote monitoring .
command jstatd It's a rmi Server program , The function is equivalent to proxy server , Establish communication between local computer and remote monitoring tool ,jstatd The server will send Java Application information is transferred to the remote computer .
边栏推荐
- Introduction to yarn (one article is enough)
- 2pc of distributed transaction solution
- 苹果cms V10模板/MXone Pro自适应影视电影网站模板
- Go语学习笔记 - gorm使用 - gorm处理错误 | Web框架Gin(十)
- Explication contextuelle du langage Go
- Sidecar mode
- 一名普通学生的大一总结【不知我等是愚是狂,唯知一路向前奔驰】
- 牙齿干细胞的存储问题(未完待续)
- Input of native applet switches between text and password types
- Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture
猜你喜欢
yarn入门(一篇就够了)
职场经历反馈给初入职场的程序员
力扣102题:二叉树的层序遍历
Web architecture design process
Get the way to optimize the one-stop worktable of customer service
如何提高网站权重
Check Point:企业部署零信任网络(ZTNA)的核心要素
Introduction to distributed transactions
苹果cms V10模板/MXone Pro自适应影视电影网站模板
[SQL practice] a SQL statistics of epidemic distribution across the country
随机推荐
mac版php装xdebug环境(m1版)
MySQL performance_ Schema common performance diagnosis query
Hcip seventh operation
10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
Loss function and positive and negative sample allocation in target detection: retinanet and focal loss
Hcip eighth operation
On the difference between FPGA and ASIC
Nodejs get client IP
Five core elements of architecture design
Interview skills of software testing
JVM命令之 jstat:查看JVM统计信息
话说SQLyog欺骗了我!
Differences and introduction of cluster, distributed and microservice
【FPGA教程案例13】基于vivado核的CIC滤波器设计与实现
OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
The solution of a simple algebraic problem
关于STC单片机“假死”状态的判别
《ClickHouse原理解析与应用实践》读书笔记(6)
R language [logic control] [mathematical operation]
Web architecture design process