当前位置:网站首页>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 .
边栏推荐
- 驱动开发中platform设备驱动架构详解
- zabbix_get测试数据库失败
- SQL Server 2008 各种DateTime的取值范围
- R语言【逻辑控制】【数学运算】
- VScode进行代码补全
- 数据中心为什么需要一套基础设施可视化管理系统
- 980. 不同路径 III DFS
- If you don't know these four caching modes, dare you say you understand caching?
- Go language learning notes - Gorm use - Gorm processing errors | web framework gin (10)
- Message queue: how to handle repeated messages?
猜你喜欢
PTA 天梯赛练习题集 L2-004 搜索树判断
pytorch_ 01 automatic derivation mechanism
三级菜单数据实现,实现嵌套三级菜单数据
JVM命令之 jstat:查看JVM统计信息
cf:C. Column Swapping【排序 + 模擬】
The boss always asks me about my progress. Don't you trust me? (what do you think)
Web architecture design process
SAP Spartacus checkout 流程的扩展(extend)实现介绍
目标检测中的BBox 回归损失函数-L2,smooth L1,IoU,GIoU,DIoU,CIoU,Focal-EIoU,Alpha-IoU,SIoU
[云原生]微服务架构是什么?
随机推荐
cf:C. Column Swapping【排序 + 模拟】
Win configuration PM2 boot auto start node project
软件测试面试技巧
mac版php装xdebug环境(m1版)
【日常训练--腾讯精选50】292. Nim 游戏
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server
linear regression
OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
PowerPivot - DAX (function)
yarn入门(一篇就够了)
驱动开发中platform设备驱动架构详解
CMD permanently delete specified folders and files
成为资深IC设计工程师的十个阶段,现在的你在哪个阶段 ?
牙齿干细胞的存储问题(未完待续)
搞懂fastjson 对泛型的反序列化原理
MFC BMP sets the resolution of bitmap, DPI is 600 points, and gdiplus generates labels
The solution of a simple algebraic problem
C. colonne Swapping [tri + Simulation]
Industrial Finance 3.0: financial technology of "dredging blood vessels"
Flask1.1.4 Werkzeug1.0.1 源碼分析:啟動流程