jstat of jvm monitoring tool

1.jstat is used to output statistics of the specified java process

Usage:
Jstat : jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
where <option> is a required option, all available options can be used jstat -options list

[root@VM_82_178_redhat ~]# jstat -options
-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation

2. Common options (with the introduction of output column names for each option)

class: Statistics of classloader behavior
compiler: Statistics of hotspot just-in-time compiler behavior
gc: Statistics of gc behavior
gccapacity: Statistics of generation capacity and space in the heap
gccause: Garbage collection statistics, including recent events that reference garbage collection, basically the same gcutil has two more columns than gcutil
gcnew: Counts the behavior of the new generation
gcnewcapacity: Counts the size and space of the new generation
gcold: Counts the behavior of the old generation
gcoldcapacity: Counts the size and space of the old generation gcpermcapacity: Counts the size and space
of the permanent generation Space
gcutil: garbage collection statistics
printcompilation: hotspot compilation method statistics
-hn every n samples, display the header once
-tn display the timestamp column in the first column, the timestamp is calculated from the start of the jvm
<vmid> is the process number
<interval> interval is the monitoring time interval, the unit is microseconds, if not provided, it means a single output
<count> count is the maximum number of outputs, if not provided and the monitoring time interval has a value, it will be printed infinitely

3. Introduction to the use of specific parameters

1.class option:

#jstat -class 4214 2000 10 (monitor every 2 seconds, 10 times in total)

Loaded Bytes Unloaded Bytes  Time 
9197   18418.   0 0    0.0  12.49 
9197   18418.   0 0    0.0  12.49
列名介绍:
Column  Description
Loaded  被读入类的数量
Bytes   被读入的字节数(K)
Unloaded    被卸载类的数量
Bytes   被卸载的字节数(K)
Time    花费在load和unload类的时间

2. Option -compiler

[root@tomcat01 test001]# jstat -compiler  13614
Compiled Failed Invalid   Time   FailedType FailedMethod
3463      2       0    70.23          1 org/apache/tomcat/util/IntrospectionUtils setProperty

3.GC options:

[root@tomcat01 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.352
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.352

Column name introduction:

Column  Description
S0C 当前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 option:
count the new generation every two seconds, a total of 5 times

[root@tomcat01 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  Description
NGCMN   年轻代的最小容量 (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:

[root@tomcat01 ~]# 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

Column name introduction:

Column  Description
LGCC    最近垃圾回收的原因
GCC 当前垃圾回收的原因

6. gcnew options:

7. gcoldcapacity option

[root@tomcat01 ~]# 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

Column name introduction:

Column  Description
OGCMN   最小年老代容量 (KB)
OGCMX   最大年老代容量(KB)
OGC 当前年老代容量 (KB)
OC  当前年老代空间 (KB)
YGC 年轻代gc次数
FGC full gc次数
FGCT    full gc时间
GCT 垃圾收集总时间

8.gcutil

[root@tomcat01 ~]# 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

Column name introduction:

Column  Description
S1  S1使用百分比
E   eden使用百分比
O   old使用百分比
P   perm使用百分比
YGC 年轻代gc次数
YGCT    年轻代gc时间
FGC full gc次数
FGCT    full gc时间
GCT 垃圾收集总时间


9. Method of compiling statistics for printcompilation

[root@tomcat01 ~]# jstat -printcompilation 13614
Compiled  Size  Type Method
    3514    173    1 net/sf/jsqlparser/parser/CCJSqlParser jj_scan_token
[root@tomcat01 ~]# jstat -printcompilation 13614
Compiled  Size  Type Method
3516    126    1 java/security/Provider$ServiceKey hashCode

Column name introduction:

Column  Description
Compiled    被执行的编译任务的数量
Size    方法字节码的字节数
Type    编译类型
Method  编译方法的类名和方法名。类名使用"/" 代替 "." 作为空间分隔符. 方法名是给出类的方法名. 格式是一致于HotSpot - XX:+PrintComplation 选项

4. View and analyze detailed stack memory space usage status information

jmap -heap 4214

Attaching to process ID 4214, please wait... 
Debugger attached successfully. 
Server compiler detected. 
JVM version is 24.55-b03 

using parallel threads in the new generation. 
using thread-local object allocation. 
Concurrent Mark-Sweep GC 

Heap Configuration:                        # 堆配置情况
MinHeapFreeRatio = 40                      #  最小堆的使用比例
MaxHeapFreeRatio = 70                      # 最大堆的可用比例
MaxHeapSize = 2684354560 (2560.0MB)        # 最大堆空间大小
NewSize = 713031680 (680.0MB)              # 新生代分配大小
MaxNewSize = 713031680 (680.0MB)           # 最大可用新生代分配大小 
OldSize = 5439488 (5.1875MB)               # 老年代大小
NewRatio = 2                               # 新生代比例
SurvivorRatio = 8                          # 新生代与suvivor的比例
PermSize = 251658240 (240.0MB)             # perm区大小
MaxPermSize = 251658240 (240.0MB)          # 最大可分配perm区大小
G1HeapRegionSize = 0 (0.0MB)               # G1堆区大小

Heap Usage:                                # 堆使用情况
New Generation (Eden + 1 Survivor Space):  # 新生代(伊甸区 + survior空间)
capacity = 641728512 (612.0MB)             # 伊甸区容量
used = 507109064 (483.6168899536133MB)     # 已经使用大小
free = 134619448 (128.38311004638672MB)    # 剩余容量
79.0223676394793% used                     # 使用比例
Eden Space:                                # 伊甸区
capacity = 570425344 (544.0MB)             # 伊甸区容量
used = 503156488 (479.84741973876953MB)    # 伊甸区使用
free = 67268856 (64.15258026123047MB)      # 伊甸区当前剩余容量
88.2072462755091% used                     # 伊甸区使用情况
From Space:                                # survior1区
capacity = 71303168 (68.0MB)               # survior1区容量
used = 3952576 (3.76947021484375MB)        # surviror1区已使用情况
free = 67350592 (64.23052978515625MB)      # surviror1区剩余容量
5.543338551240809% used                    # survior1区使用比例
To Space:                                  # survior2 区
capacity = 71303168 (68.0MB)               # survior2区容量
used = 0 (0.0MB)                           # survior2区已使用情况
free = 71303168 (68.0MB)                   # survior2区剩余容量
0.0% used                                  # survior2区使用比例
concurrent mark-sweep generation:          # 老生代使用情况
capacity = 1971322880 (1880.0MB)           # 老生代容量
used = 1514740296 (1444.5689163208008MB)   # 老生代已使用容量
free = 456582584 (435.4310836791992MB)     # 老生代剩余容量
76.83877214472345% used                    # 老生代使用比例
Perm Generation:                           # perm区使用情况
capacity = 251658240 (240.0MB)             # perm区容量
used = 57814400 (55.1361083984375MB)       # perm区已使用容量
free = 193843840 (184.8638916015625MB)     # perm区剩余容量
22.973378499348957% used                   # perm区使用比例
28645 interned Strings occupying 3168232 bytes.

Reference document:
http://nolinux.blog.51cto.com/4824967/1588716

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324646822&siteId=291194637