1. Questions
OutOfMemoryError: Insufficient memory;
Memory leaks
Thread deadlock
Lock Competition (lock contention)
Java consumes too much CPU
2. Java Common Health Tools
JPS (Java Virtual Machine Process Status tool) monitors JVM process state information
Use format:
JPS [Options] [HostID]
-M: output parameters that pass in the Main method
-L: Displays the fully qualified name of the main class or Jar
-V: Displays the parameters specified for the JVM virtual machine
Jstack : View the thread stack information within a Java process;
Use format:
jstack [Options] pid
-L Long Listings: The output of the completion of the lock information;
-M: Mixed mode, which outputs the Java stack and C + + stack information
Jmap and Jhat:
Jmap: JVM Memory map to view heap RAM usage
Jhat: Java Heap Analysis tool
Use format:
Jmap [Options] pid
-HEAP: Verbose heap memory space usage state information
-histo[:live] View the number of objects in the heap memory, the size of the statistical results;
Jstat : JVM Statistics monitoring Tool
Jstat-<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]
Where <option> is the option that must be provided, all available options can be listed using Jstat-options;
-class
-compiler
-gc
-gccapacity
-gccause
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcpermcapacity
-gcutil
-printcompilation
Field Meaning:
s0c, s1c, s0u, S1U:C represents the capacity, U represents the amount of use;
EC, capacity and amount of eu:eden area;
OC, OU
PC, PU
YGC, YGT: GC times and time-consuming in the Cenozoic;
FGC, Fgct:full GC frequency and time-consuming;
GCT:GC total time-consuming;
Two GUI tools: Jconsole, JVISUALVM
Java Performance Monitoring Tools