A practical perspective on the world of Virtual machine memory management.
First, the command-line tools of the JDK
The 1.JPS (JVM process Status tool) virtual machine processes health tools.
Displays all of the hotspot virtual machine processes in the development system.
Functionality is single, but most other JDK tools need to enter the Lvmid it queries to determine which virtual machine process to monitor. For the on-premises virtual machine process, the lvmid is consistent with the OS's process ID.
Use: JPS [options] [HostID]
Example:
2.jstat (JDK Statistic monitoring Tool) virtual machine Statistics monitor
A command-line tool for monitoring the various health status information for a virtual machine. You can display run-time data such as class loading, memory, garbage Collection, JIT compilation, and so on in a local or remote virtual machine process. No GUI interface. It is the preferred tool for locating virtual machine performance issues at run time.
Jshat format:
jshat [option VIMD [interval [s|ms] [count]]
Vmid: Virtual machine Unique ID, if the local virtual machine process, Vmid is consistent with Lvmid, if the remote virtual machine process, then the VMID format should be:
[Protocol:] [//] lvmid[@hostname [:p ort]/servername].
Interval and count: query interval and number of times. If the two parameters are not queried only once.
Option: On behalf of the user wants to query the virtual machine information, mainly divided into three categories: class loading, garbage collection, run-time compilation status.
Example:
①jstat-class 15043
Displays the number of loaded classes, as well as the occupied space, etc.
Explanation: Loaded (number of loaded classes); Bytes (number of bytes occupied by the load Class), Unloaded (number of unloaded classes), Bytes (the number of bytes unloaded), Time (duration of loading and unloading of classes)
②JSTAT-GC 15043
You can display GC information, the number of times the GC is viewed, and the time.
Explain:
s0c |
first survivor Capacity-bytes |
s1c |
capacity of second survivor |
s0u |
The first survivor has now made Space |
s1u |
second survivor currently used space |
EC |
eden capacity |
EU |
Eden currently uses space |
OC |
old generation capacity |
Td>ou
old generation has currently used space |
PC |
perm capacity |
PU |
Perm currently using space |
ygc |
from application startup to sampling when GC times in young generation |
ygct |
from app Time taken by the GC when the program starts to sample (s) |
FGC |
from application startup to sampling old (full GC) GC times |
ygct< /td> |
time taken by the GC in the young generation from application startup to sampling (s) |
GCT |
Total time from application startup to sampling GC (s) |
③jstat-gccapacity 15043
can display the use and occupancy of three-generation (Young,old,perm) objects in VM memory
Ngcmn |
Initial (minimum) size in Young generation (bytes) |
Ngcmx |
Max capacity of young generation (bytes) |
Ngc |
Current capacity in young generation (bytes) |
s0c |
Capacity of the first Survivor (Survivor area) in the Young Generation (bytes) |
S1c |
Capacity of the second survivor (Survivor area) in the younger generation (bytes) |
EC |
The capacity of Eden (Eden) in the Young Generation (bytes) |
Ogcmn |
Initial (minimum) size in old generation (bytes) |
Ogcmx |
Maximum capacity in old generation (bytes) |
OGC |
The current newly generated capacity of the old generation (bytes) |
Oc |
Capacity in old generation (bytes) |
Pgcmn |
The size (in bytes) of the initialization (minimum) in perm generation |
Pgcmx |
Maximum capacity of the perm generation (bytes) |
Pgc |
The current newly generated capacity of the perm generation (bytes) |
Pc |
Perm (persistent generation) capacity (bytes) |
Ygc |
Number of GC times in young generations from application startup to sampling |
FGC |
Old (full GC) GC times from application startup to sampling |
④jstat-gcutil 15043 Statistics GC Information the ratio of occupied space to total space
S0 |
The first survivor (Survivor area) in the younger generation has been used as a percentage of current capacity |
S1 |
The second survivor (Survivor area) of the young generation has been used as a percentage of current capacity |
E |
Eden (Eden) in the young generation has been used as a percentage of current capacity |
O |
Percentage of current capacity used by old generation |
P |
Percentage of current capacity used by perm generation |
Ygc |
Number of GC times in young generations from application startup to sampling |
Ygct |
Time taken by the young generation GC from application startup to sampling (s) |
FGC |
Old (full GC) GC times from application startup to sampling |
Fgct |
Time (s) used by the old (full GC) GC from application startup to sampling |
GCT |
Total time (s) used by GC from application startup to sampling |
Virtual machine performance monitoring and fault handling tools