JPS Viewing the currently running Java process
The JVM process Status Tool displays all the hotspot virtual machine processes within the specified system.
The JPS-LVM is used to view the 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 parameters that pass in the Main method
-L OUTPUT The full name of the 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
The Jstat (JVM statistics monitoring) is a command that monitors the state information of a virtual machine, and it can display run data such as class loading, memory, garbage Collection, JIT compilation, and so on in the process of virtual machines. 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 Class class loader behavior statistics. 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. Behavior statistics for 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), the reason for attaching the last two GC events. Summary of Garbage
Collection statistics (same as-gcutil), with the cause of the
and gcnew Cenozoic Behavioral 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 of the old generation and the generation of immortal behavior statistics. Statistics of the behavior of the old and permanent
Generations. Gcoldcapacity old generation behavior statistics. Statistics of the sizes of the old generation. Gcmetacapacity Meta Data spatial statistics.
Generation. Printcompilation hotspot Compilation Method statistics. HotSpot Compilation Method Statistics.The option parameter is detailed -class monitoring 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: The number of loaded class
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 number of time and so on [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
Failedtype: Failure type
Failedmethod: The fully qualified name of the failed method -GC The garbage collection heap behavior statistics, common commands [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gc 21275
s0c s1c s0u s1u EC EU OC OU MC MU ccsc ccsu ygc ygct FGC fgct GCT
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 is the total capacity of capacity, u that is used used capacity
Total capacity of the S0c:survivor0 area
Total capacity of the S1c:survivor1 area
S0u:survivor0 area already used capacity
S1c:survivor1 area already used capacity
Total capacity of the Ec:eden area
Eu:eden area already used capacity
Total capacity of the Oc:old area
Ou:old area already used capacity
MC: Method Area Size
MU: Method Area Use size
CCSC: Compression class space size
CCSU: Compression class space usage size
YGC: Number of new generation garbage collection
YGCT: New Generation garbage collection time
FGC: Garbage collection times in the old age
FGCT: Garbage collection time in the old age
GCT: Total garbage collection consumption time [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gc 21275
This command means that every 2000ms output 1262 GC case, a total output 20 times -gccapacity with-GC, but also output the Java heap to use the maximum and 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: Cenozoic Minimum capacity
NGCMX: Maximum capacity of the Cenozoic
NGC: Current Cenozoic capacity
S0C: Size of the first surviving area
S1C: The size of the second surviving area
EC: Size of the Eden District
OGCMN: The old age minimum capacity
OGCMX: Maximum capacity of the old age
OGC: Current old age size
OC: Current old age size
MCMN: Minimum meta-data capacity
MCMX: Maximum meta data capacity
MC: Current meta-data space size
CCSMN: Minimum compression class space size
Ccsmx: Maximum compression class space size
CCSC: Current Compression class space size
YGC: Young Generation GC Number
FGC: The old times GC times -gcutil with-GC, but the output is the percentage of the space used to occupy the total space [root@izbp1bmo3l7m8z7ac5bi4wz ~]# jstat-gcutil 21275
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: Survival Zone 1 Current usage ratio
S1: Survival Zone 2 Current usage ratio
E: Eden Area usage ratio
O: Proportions used in the old age
M: Meta data Area usage scale
CCS: Compression usage ratio
YGC: Number of young generations of garbage collection
FGC: Garbage collection times in the old age
FGCT: Time spent on garbage collection in the old age
GCT: Total GC consumption time -gccause garbage Collection Statistics Overview (same as-gcutil), additional reasons for 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: Reasons for recent garbage collection
GCC: Reasons for current garbage collection -gcnew statistics 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: Size of the first surviving area
S1C: The size of the second surviving area
S0U: The use size of the first surviving area
S1U: The use size of the second surviving area
TT: Number of objects surviving in the Cenozoic
MTT: Maximum number of objects surviving in the Cenozoic
DSS: Desired Surviving area size
EC: Size of the Eden District
EU: The use of the Eden area size
YGC: Number of young generations of garbage collection
YGCT: Young generation garbage collection consumes time -gcnewcapacity generation and 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: Cenozoic Minimum capacity
NGCMX: Maximum capacity of the Cenozoic
NGC: Current Cenozoic capacity
S0CMX: Maximum surviving 1 zone size
S0C: Currently surviving 1 area size
S1CMX: Maximum surviving 2 zone size
S1C: Currently surviving 2 area size
ECMX: Max Eden Area Size
EC: Current Eden Area Size
YGC: Number of young generations of garbage collection
FGC: Collection Count of old age -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 Use size
CCSC: Compression class space size
CCSU: Compression class space usage size
OC: old age Size
OU: old age Use size
YGC: Number of young generations of garbage collection
FGC: Garbage collection times in the old age
FGCT: Time spent on garbage collection in the old age
GCT: Total time spent on garbage collection -gcoldcapacity memory statistics for the old age [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: The old age minimum capacity
OGCMX: Maximum capacity of the old age
OGC: Current old age size
OC: old age Size
YGC: Number of young generations of garbage collection
FGC: Garbage collection times in the old age
FGCT: Time spent on garbage collection in the old age
GCT: Total garbage collection consumption time -gcmetacapacity metadata Spatial 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 meta-data space size
CCSMN: Minimum compression class space size
Ccsmx: Maximum compression class space size
CCSC: Current Compression class space size
YGC: Number of young generations of garbage collection
FGC: Garbage collection times in the old age
FGCT: Time spent on garbage collection in the old age
GCT: Total garbage collection consumption 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 to be executed
Size: The number of bytes in the method byte code
Type: Compilation type
Method: The class name and the method name of the compiled methods. The class name uses "/" instead of "." As the space delimiter. The method name is the method name given to the class. The format is consistent with the hotspot-xx:+printcomplation option jmap
The Jmap (JVM Memory Map) command is used to generate a heap dump file, and if you do not use this command, you can also use the
-xx:+heapdumponoutofmemoryerror parameter to allow the virtual machine to appear in 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: Generate heap Dump snapshot Finalizerinfo: Object that displays the finalizer method that the F-queue queue waits for the finalizer thread to execute the heap: Show Java heap Details Histo: Displays statistics for objects in the heap permstat:to print permanent generation statistics F: Forces a dump snapshot-dump heap to a file when-dump is not responding, format specifies the output Out of format, live indicates the object is alive, file specifies the file name
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# jmap-dump:live,format=b,file=/data/dump.hprof 21275
Dumping Heap to/data/ dump.hprof ... Dump.hprof This suffix is for subsequent use of the mat (Memory anlysis Tool) to open the
Heap dump file created
jmap-heap 21275
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# Jmap-heap 21275 attaching to process ID 21275, please wait ...
Debugger attached successfully.
Server compiler detected.
The 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 startup parameters-xx:maxheapfreeratio set JVM heap max idle ratio (default 7 0) Maxheapsize = 1040187392 (992.0MB)//corresponding to JVM startup parameters-xx:maxheapsize= Set maximum size of JVM heap NewSize = 21495808 (20.5MB)//corresponding to the JVM startup parameters-xx:newsize= Set the default size of the JVM heap ' cenozoic ' maxnewsize = 346554368 (330.5MB)//corresponding 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 boot parameter-xx:oldsize=<value>: Set JVM heap ' Laosheng generation ' size Newratio = 2//corresponds to JVM startup parameters-xx:newratio=: ' Cenozoic ' and ' laosheng generation ' size ratio survivorratio = 8//corresponding JVM boot parameter
Number-xx:survivorratio= Set the ratio of the size of Eden and survivor in younger generations Metaspacesize = 21807104 (20.796875MB) compressedclassspacesize = 1073741824 (1024.0MB) maxmetaspacesiz E = 17592186044415 MB g1heapregionsize = 0 (0.0MB) heap usage://stack memory usage PS young Generation Eden Space ://eden area Memory Distribution capacity = 152567808 (145.5MB) used = 59283704 (56.53734588623047MB) free = 93284104 (88.962 65411376953MB) 38.857282396034684% used from space://memory distribution in one of the survivor areas capacity = 91750400 (87.5MB) used = 8 980384 (8.564361572265625MB) free = 82770016 (78.93563842773438MB) 9.787841796875% used to space://another survivor zone Memory Distribution capacity = 88080384 (84.0MB) used = 0 (0.0MB) free = 88080384 (84.0MB) 0.0% used PS old Generatio n//current old area memory distribution capacity = 340262912 (324.5MB) used = 253308808 (241.57410430908203MB) free = 86954104 (82 .92589569091797MB) 74.44502444039507% used 27183 interned Strings occupying 3099760 bytes.
-histo The object count of the print heap, including the number of objects, the size of the memory, and so on (because full GC is performed before Dump:live, and only live objects are counted if live is taken, so the heap size without live is greater than the size of the live heap)
The object type, described below:
B byte
C Char
D Double
F float
I int
J Long
Z Boolean
[Array, such as [i = int[]
[L + Class name other objects
[Root@izbp1bmo3l7m8z7ac5bi4wz ~]# jmap-histo:live 21275 | More num #instances #bytes class name----------------------------------------------1:260 136417376 [I 2:118028 49763864 [C 3:20783 40449448 [B 4:109,427]
2626248 java.lang.String 5:28428 2269088 [Ljava.lang.Object; 6:19176 1687488 java.lang.reflect.Method 7:9969 1114448 java.lang.Class 8: 30010 960320 java.util.concurrent.concurrenthashmap$node 9:27779 888928 java.util.hashmap$ Node 10:24000 768000 org.apache.velocity.runtime.parser.parser$jjcalls 11:8,314 661
080 [S 12:4813 620696 [Ljava.util.hashmap$node; 13:21298 511152 java.util.ArrayList 14:7516 481024 Java.net.URL 15:11,290
361280 java.lang.ref.WeakReference16:8854 354160 java.util.linkedhashmap$entry 17:5926 331856 java.util.LinkedHashMa P 18:6217 298416 java.util.HashMap 19:255 291040 [Ljava.util.concurrent.Concurr
Enthashmap$node; 20:6010 288480 org.apache.catalina.loader.ResourceEntry 21:3999 287928 org.apache.
Velocity.runtime.parser.VelocityCharStream 22:12742 276920 [Ljava.lang.Class;
23:2731 262176 sun.util.calendar.gregorian$date 24:5195 245216 [Ljava.lang.String; 25:5434 217360 java.lang.ref.SoftReference 26:2000 208000 ORG.APACHE.VELOCITY.R Untime.parser.Parser 27:12797 204752 java.lang.Object 28:4878 195120 com.sun.org. Apache.xerces.internal.dom.DeferredTextImpl 29:4013 192624 Java.nio.HeapByteBuffer 30:200 0 192000 Org.apachE.velocity.runtime.parser.parsertokenmanager 31:3999 191952 Sun.nio.cs.StreamDecoder 32:5 815 186080 java.util.hashtable$entry 33:4000 160000 sun.nio.cs.utf_8$decoder 34: 3739 149560 Com.sun.org.apache.xerces.internal.dom.DeferredAttrImpl 35:3023 145104 Org.apach E.velocity.runtime.parser.token 36:1739 139120 java.lang.reflect.Constructor 37:2,160 138240 com.mysql.jdbc.connectionpropertiesimpl$booleanconnectionproperty 38:5744 137856 Java.bea Ns. MethodRef 39:2399 134344 Com.sun.org.apache.xerces.internal.dom.DeferredElementImpl 40:20
XX 128000 [Lorg.apache.velocity.runtime.parser.parser$jjcalls; 41:3998 127936 java.io.ByteArrayInputStream 42:2566 123168 ORG.ASPECTJ.WEAVER.REFL Ect. Shadowmatchimpl 43:1848 103488 Java.beans.MeThoddescriptor 44:4209 101016 Org.springframework.core.MethodClassKey 45:3,999 95
976 java.io.InputStreamReader 46:549 83768 [Ljava.util.hashtable$entry; 47:2070 82800 java.util.weakhashmap$entry 48:2572 82304 java.sql.Timestamp 49: 2566 82112 org.aspectj.weaver.patterns.ExposedState 50:837 80352 Org.springfram Ework.beans.GenericTypeAwarePropertyDescriptor 51:1109 79848 java.beans.PropertyDescriptor 52: 1843 73720 java.util.treemap$entry 53:941 67752 Java.lang.reflect.Field 54: 64000 Org.apache.commons.lang.text.StrBuilder 55:2000 64000 ORG.APACHE.VELOCITY.R Untime.parser.JJTParserState 56: