JPS View the currently running Java process
JVM process Status Tool, which displays all hotspot virtual machine processes within the specified system.
JPS-LVM is used to view Java processes running on the current machine.
command format JPS [options] [HostID]
Note: If you do not specify HostID, the current host or server is assumed to be the default.
The command-line parameter options are described below:
-Q does not output the class name, jar name, and parameters passed in the Main method
-m output the parameters passed in the Main method
-L output Full name of main class or Jar
-V Output parameters for incoming JVM
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# JPS-LVM
10870 Org.apache.catalina.startup.Bootstrap start-djava.util.logging.config.file=/data/apache-tomcat-8066/conf/ Logging.properties-djava.util.logging.manager=org.apache.juli.classloaderlogmanager- djdk.tls.ephemeraldhkeysize=2048-djava.endorsed.dirs=/data/apache-tomcat-8066/endorsed-dcatalina.base=/data/ Apache-tomcat-8066-dcatalina.home=/data/apache-tomcat-8066-djava.io.tmpdir=/data/apache-tomcat-8066/temp
16204 Org.apache.catalina.startup.Bootstrap start-djava.util.logging.config.file=/data/apache-tomcat-7.0.72/conf /logging.properties-djava.util.logging.manager=org.apache.juli.classloaderlogmanager- djdk.tls.ephemeraldhkeysize=2048-dfile.encoding=utf8-dsun.jnu.encoding=utf8-djava.endorsed.dirs=/data/ apache-tomcat-7.0.72/endorsed-dcatalina.base=/data/apache-tomcat-7.0.72-dcatalina.home=/data/ Apache-tomcat-7.0.72-djava.io.tmpdir=/data/apache-tomcat-7.0.72/temp
17740 sun.tools.jps.jps-lvm-denv.class.path=.:/ data/jdk1.8.0_102/lib/dt.jar:/data/jdk1.8.0_102/lib/tools.jar:/data/jdk1.8.0_102/jre/lib-dapplication.home=/ Data/jdk1.8.0_102-xms8m
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]#Jstat
Jstat (JVM statistics monitoring) is a command for monitoring virtual run-time state information, which can display run-time data such as class loading, memory, garbage Collection, JIT compilation, and so on in a virtual machine process. command Format
jstat [option] PID [interval] [count] parameter
[option]: Operation parameters
Lvmid: local virtual machine process ID
[Interval]: time interval for continuous output
[Count]: number of consecutive outputsoption Parameter overviewThe behavior statistics for Class class loader. Statistics on the behavior of the class
Loader. Compiler hotspt JIT compiler behavior statistics. Statistics of the behavior of the HotSpot
Just-in-Time compiler. The behavior statistics of the GC garbage collection heap. Statistics of the behavior of the garbage collected
Heap. Gccapacity each garbage collection generation capacity (Young,old,perm) and their corresponding spatial statistics. Statistics of the
Capacities of the generations and their corresponding spaces. Gcutil garbage Collection Statistics overview. Summary of garbage collection statistics. Gccause Garbage Collection Statistics Overview (same as-gcutil), attaching the reason for the last two garbage collections events. Summary of Garbage
Collection statistics (same as-gcutil), with the cause of the last
and gcnew Cenozoic behavior statistics. Statistics of the behavior of the new generation. Gcnewcapacity the new generation and its corresponding memory space statistics. Statistics of the sizes of the new
Generations and its corresponding spaces. Gcold The age and immortality of the generation of behavioral statistics. Statistics of the behavior of the old and permanent
Generations. Gcoldcapacity of old age behavior statistics. Statistics of the sizes of the old generation. Gcmetacapacity Meta data space statistics.
Generation. Printcompilation hotspot Compilation Method statistics. HotSpot Compilation Method Statistics.option Parameter Detailed -class Monitor class load, unload quantity, total space, and time spent [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-class 21275
Loaded Bytes unloaded Bytes time
9293 17927.5 0 0.0 33.90
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]#
Loaded: Number of class loaded
Bytes:class byte size
Unloaded: Number of class not loaded
Bytes: Byte size of class not loaded
Time: Load times -compiler output JIT-compiled method quantity time-consuming etc [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-compiler 21275
Compiled Failed Invalid Time Failedtype Failedmethod
10869 1 0 24.52 1 org/aspectj/weaver/iterators$6 hasnext
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]#
Compiled: Number of compilations
Failed: Number of compilation failures
Invalid: Invalid Quantity
Time: Compilation Time consuming
Failedtype: Failure type
Failedmethod: The fully qualified name of the failed method -GC The behavior statistics of the garbage collection heap, commonly used commands [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gc 21275
s0c s1c s1u EC EU OC OU MC MU CCSC ccsu ygc ygct FGC s0u FGCT
86016.0 89600.0 0.0 8769.9 148992.0 26212.9 332288.0 247371.9 59008.0 57361.6 6784.0 6348.8 17 0.379 3 0.345-0.724
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]#
C that is the total capacity of capacity, u that used already used capacity
Total capacity of the S0c:survivor0 area
Total capacity of the S1c:survivor1 area
Capacity used in the S0u:survivor0 area
Capacity used in the S1c:survivor1 area
Total capacity of the Ec:eden area
Capacity used in the Eu:eden area
Total capacity of the Oc:old area
Capacity used in the Ou:old area
MC: Method Area Size
MU: Method Area uses size
CCSC: Compressed class space size
CCSU: Compressed class space usage size
YGC: The number of new generation garbage collection
YGCT: New Generation garbage collection time
FGC: old age garbage collection times
FGCT: Old age garbage collection time
GCT: Garbage Collection total consumption time [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gc 21275
This command means that every 2000ms output 1262 of the GC situation, a total of 20 -gccapacity with-GC, but also output the Java heap in each area to use the largest, minimum space [ Root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gccapacity 21275
NGCMN ngcmx NGC s0c s1c EC ogcmn ogcmx OGC OC mcmn mcmx MC ccsmn ccsmx CCSC YGC FGC
20992.0 338432.0 337920.0 86016.0, 89600.0 148992.0 42496.0 677376.0 332288.0 332288.0 0.0 1101824.0 59008.0 0.0 1048576.0 6784.0 17 3
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]#
NGCMN: New Generation minimum capacity
NGCMX: New Generation Maximum capacity
NGC: Current Cenozoic capacity
S0C: The first surviving zone size
S1C: Size of the second surviving area
EC: Size of the Eden area
OGCMN: old age Minimum Volume
OGCMX: old age Max capacity
OGC: Current old age size
OC: Current old age size
MCMN: Minimum meta data capacity
MCMX: Maximum meta data capacity
MC: Current metadata space size
CCSMN: Minimum compression class space size
Ccsmx: Maximum compression class space size
CCSC: Current Compressed class space size
YGC: The number of the younger generation GC
FGC: The old age GC number -gcutil with-GC, but the output is the percentage of total space used space [root@izbp1bmo3l7m8z7ac5bi4wz ~]# Jstat-gcutil
S0 S1 E O M CCS ygc ygct FGC fgct GCT
0.00 9.79 21.39 74.45 97.21 93.59 17 0.379 3 0.345 0.724
S0: Percentage of the surviving 1 districts currently in use
S1: Percentage of the surviving 2 districts currently in use
E: Percentage of Eden area used
O: Proportions used in old age
M: Scale used in the metadata area
CCS: Compression usage ratio
YGC: The number of garbage collection in the younger generation
FGC: old age garbage collection times
FGCT: Old age garbage collection consumption time
GCT: Total Garbage Collection time-gccause GC overview (with-gcutil), the reason for attaching the last two garbage collection events [root@izbp1bmo3l7m8z7ac5bi4wz ~]# Jstat- Gccause 21275
S0 S1 E O M CCS ygc ygct FGC fgct GCT LGCC GCC
0.00 9.79 21.39 74.45 97.21 93.59-0.379 3 0.345 0.724 allocation failure No GC
LGCC: The reason for the recent garbage collection
GCC: The cause of current garbage collection -gcnew statistical cenozoic behavior [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcnew 21275
s0c s1c s0u s1u TT-MTT DSS EC EU YGC YGCT
86016.0 89600.0 0.0 8769.9 4 15 86016.0 148992.0 34327.2 17 0.379
S0C: The first surviving zone size
S1C: Size of the second surviving area
S0U: The use size of the first surviving zone
S1U: The use size of the second surviving area
TT: The number of times the object survived in the Cenozoic
MTT: The maximum number of objects surviving in the Cenozoic
DSS: Expected size of the surviving zone
EC: Size of the Eden area
European Union: The size of the Eden area
YGC: The number of garbage collection in the younger generation
YGCT: Young generation garbage collection consumption time -gcnewcapacity the new generation and its corresponding memory space statistics [Root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcnewcapacity 21275
NGCMN ngcmx NGC s0cmx s0c s1cmx s1c ecmx EC YGC FGC
20992.0 338432.0 337920.0 112640.0 86016.0 112640.0 89600.0 337408.0 148992.0 17 3
NGCMN: New Generation minimum capacity
NGCMX: New Generation Maximum capacity
NGC: Current Cenozoic capacity
S0CMX: Size of the largest surviving zone 1
S0C: Currently surviving 1-zone size
S1CMX: Size of the largest surviving zone 2
S1C: Currently surviving 2-zone size
ECMX: largest Eden area size
EC: Current size of Eden area
YGC: The number of garbage collection in the younger generation
FGC: old age recycling times -gcold garbage Collection Statistics [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcold 21275
MC MU CCSC CCSU OC OU ygc FGC fgct GCT
59008.0 57361.6 6784.0 6348.8 332288.0 247371.9 17 3 0.345 0.724
MC: Method Area Size
MU: Method Area uses size
CCSC: Compressed class space size
CCSU: Compressed class space usage size
OC: old age Size
OU: old age Use size
YGC: The number of garbage collection in the younger generation
FGC: old age garbage collection times
FGCT: Old age garbage collection consumption time
GCT: Total garbage collection time -gcoldcapacity old age Memory Statistics [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcoldcapacity 21275
OGCMN ogcmx OGC OC ygc FGC fgct GCT
42496.0 677376.0 332288.0 332288.0 17 3 0.345 0.724
OGCMN: old age Minimum Volume
OGCMX: old age Max capacity
OGC: Current old age size
OC: old age Size
YGC: The number of garbage collection in the younger generation
FGC: old age garbage collection times
FGCT: Old age garbage collection consumption time
GCT: Garbage collection consumption total time -gcmetacapacity metadata Space statistics [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcmetacapacity 21275
MCMN mcmx MC ccsmn ccsmx CCSC ygc FGC fgct GCT
0.0 1101824.0 59008.0 0.0 1048576.0 6784.0 17 3 0.345 0.724
MCMN: Minimum meta data capacity
MCMX: Maximum meta data capacity
MC: Current metadata space size
CCSMN: Minimum compression class space size
Ccsmx: Maximum compression class space size
CCSC: Current Compressed class space size
YGC: The number of garbage collection in the younger generation
FGC: old age garbage collection times
FGCT: Old age garbage collection consumption time
GCT: Total garbage collection Time -printcompilation hotspot compilation Method Statistics (JVM compilation method statistics) [Root@izbp1bmo3l7m8z7ac5bi4wz ~]# Jstat- Printcompilation 21275
Compiled Size Type method
10954 307 1 Java/util/formatter$formatspecifier printstring
Compiled: Number of compiled tasks performed
Size: Method byte number of byte code
Type: Compilation type
Method: The class name and method name of the compilation methods. The class name uses "/" instead of "." As the space separator. The method name is the method name given to the class. Format is consistent with the hotspot-xx:+printcomplation option jmap
The Jmap (JVM Memory Map) command is used to generate heap dump files, and if you do not use this command, you can also use the
-xx:+heapdumponoutofmemoryerror parameters to allow the virtual machine to appear oom • Automatically generate dump files.
Jmap not only generates dump files, it can also query the details of the Finalize execution queue, Java heap, and permanent generation, such as current usage, which collector is currently in use, and so on. command Format
jmap [option] PID parameter dump: Build heap Dump Snapshot Finalizerinfo: Display the object finalizer the F-queue queue waiting for finalizer thread to execute heap: Show Java heap Details Histo: Displays statistics for objects in the heap permstat:to print permanent generation statistics F: When-dump does not respond, forces a dump snapshot -dump heap to the file, format refers The output format, live indicates that the object is alive, file specifies the filename
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# jmap-dump:live,format=b,file=/data/dump.hprof 21275
Dumping Heap dump.hprof ... Dump.hprof This suffix is for subsequent direct use Mat (Memory anlysis Tool) to open
Heap dump file created
1 2 3
jmap-heap 21275
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# Jmap-heap 21275 attaching to process ID 21275.
Debugger attached successfully.
Server compiler detected.
JVM version is 25.102-b14 using Thread-local object allocation. Parallel GC with 2 thread (s)//gc mode Heap configuration://heap memory initialization configuration Minheapfreeratio = 0//corresponding JVM startup parameters-xx:minhea Pfreeratio set JVM heap minimum idle ratio (default) Maxheapfreeratio = 100//corresponding JVM boot parameter-xx:maxheapfreeratio set maximum idle rate for JVM heap (default 7 0) Maxheapsize = 1040187392 (992.0MB)//corresponding JVM startup parameters-xx:maxheapsize= Setting the maximum size of the JVM heap newsize = 21495808 (20.5MB)//corresponds to JVM startup parameters-xx:newsize= Set the default size of the JVM heap's ' cenozoic ' maxnewsize = 346554368 (330.5MB)//corresponds to the JVM startup parameters-xx : maxnewsize= sets the maximum size of the ' Cenozoic ' of the JVM heap oldsize = 43515904 (41.5MB)//corresponds to the JVM startup parameter-xx:oldsize=<value>: Set the JVM Heap's The size of the Newratio = 2//corresponds to the JVM startup parameters-xx:newratio=: The size ratio of ' cenozoic ' and ' aged generation ' survivorratio = 8//corresponding JVM startup parameter
Number-xx:survivorratio= Setting the ratio of the size of Eden area and survivor area in the younger generation Metaspacesize = 21807104 (20.796875MB) compressedclassspacesize = 1073741824 (1024.0MB) maxmetaspacesiz E = 17592186044415 MB g1heapregionsize = 0 (0.0MB) Heap usage://heap memory usage PS young Generatio