1.jstat for outputting statistics for a specified Java process
Usage:
Jstat:jstat-<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]
The <option> is the option that must be provided, all available options can be listed using Jstat-options
[[email protected]_82_178_redhat ~]# jstat -options-class-compiler-gc-gccapacity-gccause-gcmetacapacity-gcnew-gcnewcapacity-gcold-gcoldcapacity-gcutil-printcompilation
2. Common options (included in the output column name for each option)
Class: The behavior of statistical classloader
Compiler: Statistics the behavior of the hotspot Just-in-time compiler
GC: Statistical GC Behavior
Gccapacity: The capacity and space of the generation in the statistical heap
Gccause: Garbage collection statistics, including recent events that cite garbage collection, are basically the same as Gcutil, with two more columns than gcutil
Gcnew: Statistical behavior of the Cenozoic
Gcnewcapacity: Statistics on the size and space of the Cenozoic
Gcold: Statistics on the behavior of old generation
Gcoldcapacity: Statistics on the size and space of old generation
Gcpermcapacity: Statistics on the size and space of permanent generations
Gcutil: Garbage Collection statistics
Printcompilation:hotspot Compilation Method Statistics
-h n per n samples, show header once
-T n displays the timestamp column in the first column, and the timestamp is calculated from the beginning of the JVM startup
<vmid> is the process number
<interval> interval is a monitoring time interval, in which the unit is subtle and does not provide means a single output
<count> count is the maximum number of outputs, not provided and the monitoring interval has values, the infinite printing
3. Introduction to the use of specific parameters
1.class options:
#jstat-class 4214 2000 10 (monitored every 2 seconds, 10 times)
Loaded Bytes Unloaded Bytes Time 9197 18418. 0 0 0.0 12.49 9197 18418. 0 0 0.0 12.49列名介绍:Column DescriptionLoaded 被读入类的数量Bytes 被读入的字节数(K)Unloaded 被卸载类的数量Bytes 被卸载的字节数(K)Time 花费在load和unload类的时间
2. Option-compiler
[[email protected] test001]# jstat -compiler 13614Compiled Failed Invalid Time FailedType FailedMethod3463 2 0 70.23 1 org/apache/tomcat/util/IntrospectionUtils setProperty
3.GC options:
[[email protected] test001]# jstat -gc 13614 2000 10 S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT 69888.0 69888.0 0.0 440.5 559232.0 392816.0 1398144.0 200682.0 131072.0 91892.5 665 5.352 0 0.000 5.35269888.0 69888.0 0.0 440.5 559232.0 392816.0 1398144.0 200682.0 131072.0 91892.5 665 5.352 0 0.000 5.352
The column name describes:
Column DescriptionS0C 当前S0的容量 (KB)S1C 当前S1的容量 (KB)S0U S0已使用 (KB)S1U S1已使用 (KB)EC 当前eden的容量(KB)EU Eden已使用 (KB)OC 当前old的容量(KB)OU Old已使用 (KB)PC 当前perm的容量 (KB)PU Perm已使用 (KB)YGC young代gc的次数YGCT young代gc花费的时间FGC full gc的次数FGCT full gc的时间GCT 垃圾收集收集的总时间
4.gccapacity options:
The new generation is counted every two seconds, counting 5 times.
[[email protected] test001]# jstat -gccapacity 13614 2000 5 NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC PGCMN PGCMX PGC PC YGC FGC 699008.0 699008.0 699008.0 69888.0 69888.0 559232.0 1398144.0 1398144.0 1398144.0 1398144.0 131072.0 262144.0 131072.0 131072.0 699 0
列名介绍:Column DescriptionNGCMN 年轻代的最小容量 (KB)NGCMX 年轻代的最大容量 (KB)NGC 当前年轻代的容量 (KB)S0C 当前S0的空间 (KB)S1C 当前S1的空间 (KB)EC 当前eden的空间 (KB)OGCMN 年老代的最小容量 (KB)OGCMX 年老代的最大容量 (KB)OGC 当前年老代的容量 (KB)OC 当前年老代的空间 (KB)PGCMN 永久代的最小容量 (KB)PGCMX 永久代的最大容量 (KB)PGC 当前永久代的容量 (KB)PC 当前永久代的空间 (KB)YGC 年轻代gc的次数FGC full gc的次数
5.gccause Parameters:
[[email protected] ~]# jstat -gccause 13614 S0 S1 E O P YGC YGCT FGC FGCT GCT LGCC GCC 1.63 0.00 33.97 14.39 70.21 726 5.674 0 0.000 5.674 Allocation Failure No GC
The column name describes:
Column DescriptionLGCC 最近垃圾回收的原因GCC 当前垃圾回收的原因
6.gcnew options:
7.gcoldcapacity Options
[[email protected] ~]# jstat -gcoldcapacity 13614 OGCMN OGCMX OGC OC YGC FGC FGCT GCT 1398144.0 1398144.0 1398144.0 1398144.0 779 0 0.000 5.976
The column name describes:
Column DescriptionOGCMN 最小年老代容量 (KB)OGCMX 最大年老代容量(KB)OGC 当前年老代容量 (KB)OC 当前年老代空间 (KB)YGC 年轻代gc次数FGC full gc次数FGCT full gc时间GCT 垃圾收集总时间
8.gcutil
[[email protected] ~]# jstat -gcutil 13614 2000 10 S0 S1 E O P YGC YGCT FGC FGCT GCT 0.68 0.00 98.02 14.48 70.23 804 6.117 0 0.000 6.117 0.00 0.83 34.27 14.48 70.23 805 6.124 0 0.000 6.124 0.00 0.83 34.27 14.48 70.23 805 6.124 0 0.000 6.124
The column name describes:
Column DescriptionS1 S1使用百分比E eden使用百分比O old使用百分比P perm使用百分比YGC 年轻代gc次数YGCT 年轻代gc时间FGC full gc次数FGCT full gc时间GCT 垃圾收集总时间
9.printcompilation
Methods for compiling statistics
[[email protected] ~]# jstat -printcompilation 13614Compiled Size Type Method 3514 173 1 net/sf/jsqlparser/parser/CCJSqlParser jj_scan_token
[[email protected] ~]# jstat -printcompilation 13614Compiled Size Type Method3516 126 1 java/security/Provider$ServiceKey hashCode
The column name describes:
Column DescriptionCompiled 被执行的编译任务的数量Size 方法字节码的字节数Type 编译类型Method 编译方法的类名和方法名。类名使用"/" 代替 "." 作为空间分隔符. 方法名是给出类的方法名. 格式是一致于HotSpot - XX:+PrintComplation 选项
4. Detailed stack memory space usage status information view analysis
Jmap-heap 4214
Attaching to process ID 4214, please wait ... Debugger attached successfully. Server compiler detected. The JVM version is 24.55-b03 using parallel threads in the new generation. Using Thread-local object allocation. Concurrent mark-sweep GC heap configuration: # heap config condition minheapfreeratio = 40 # Most Small heap usage ratio maxheapfreeratio = 70 # Maximum heap available scale maxheapsize = 2684354560 (2560.0MB) # Maximum heap space size newsize = 713031680 (680.0MB) # cenozoic allocation size maxnewsize = 713031680 (680.0MB) # Maximum available Cenozoic allocation size oldsize = 5439488 (5.18 75MB) # old age Size Newratio = 2 # Cenozoic Ratio survivorratio = 8 # The ratio of Cenozoic to suvivor permsize = 251658240 (240.0MB) # perm area Size MaxPermSize = 251658240 (240.0MB) # Maximum assignable perm area large Small g1heapregionsize = 0 (0.0MB) # G1 heap Area Size heap usage: # Heap usage new Generation (Eden + 1 Survivor space): # Cenozoic (Eden Zone + survior) capacity =641728512 (612.0MB) # Eden area Capacity used = 507109064 (483.6168899536133MB) # already used size free = 134619448 (128.3831100463 8672MB) # remaining capacity 79.0223676394793% used # usage ratio eden Space: # Eden District Capacity = 570425344 (544.0MB) # Eden area Capacity used = 503156488 (479.84741973876953MB) # Eden Zone Use free = 67268856 (64.1525802612 3047MB) # The current remaining capacity of Eden District 88.2072462755091% used # Eden area usage from Space: # s Urvior1 Zone capacity = 71303168 (68.0MB) # Survior1 area capacity used = 3952576 (3.76947021484375MB) # Surviror1 zone used Situation free = 67350592 (64.23052978515625MB) # Surviror1 area remaining capacity 5.543338551240809% used # Survior1 area use proportional to Space: # Survior2 Zone capacity = 71303168 (68.0MB) # Survior2 area capacity used = 0 (0.0M B) # Survior2 area Used free = 71303168 (68.0MB) # Survior2 area remaining capacity 0.0% used# Survior2 Zone Use proportional concurrent mark-sweep generation: # Laosheng Generation usage capacity = 1971322880 (1880.0MB) # Laosheng generation capacity used = 1514740296 (1444.5689163208008MB) # Laosheng used Capacity free = 456582584 (435.4310836791992MB) # Laosheng generation remaining capacity 76.83877214472345% use D # Laosheng Use proportional perm Generation: # perm Zone Usage capacity = 251658240 (240.0MB) # perm Area Capacity used = 57814400 (55.1361083984375MB) # perm area used Capacity free = 193843840 (184.8638916015625MB) # Perm Area remaining capacity Volume 22.973378499348957% used # perm zone use proportional 28645 interned Strings occupying 3168232 bytes.
Reference Documentation:
http://nolinux.blog.51cto.com/4824967/1588716
Jstat of JVM Monitoring tools