JVM Monitoring Tool Usage Guidance 2010-09-27 15:39 DOLPHIN-YGJ javaeye.comfont Size:T | T
The use of the JVM monitoring tools can be found in time to remove the security risks, and here to describe the usage of several commonly used JVM monitoring tools, hoping to help you learn.
Ad:51cto Net + the first App innovation contest hot Start-----------super million resources for you to take!
Here we describe the use of JVM monitoring tools, such as JSTATD, to start the JVM monitoring service. It is an RMI-based application that provides information about native JVM applications to remote machines. Default Port 1099.
Introduction to JVM monitoring tools
Jstatd
This JVM monitoring tool is used to start the JVM monitoring service. It is an RMI-based application that provides information about native JVM applications to remote machines. Default Port 1099.
Example: Jstatd-j-djava.security.policy=my.policy
The My.policy file needs to be built itself, as in the following:
- Grantcodebase "File: $JAVA _home/lib/tools.jar" {
- Permissionjava.security.AllPermission;
- };
This is a security policy file because the JDK does a Jaas security check on the JVM, so we have to set some policies so that JSTATD is allowed to operate on the network
JPS of JVM Monitoring tools
List all instances of the JVM
Example: JPS
List all JVM instances on this machine
jps192.168.0.77
List all JVM instances of the remote server 192.168.0.77 machine, using RMI protocol, the default connection port is 1099
(If the remote server provides JSTATD service)
The output reads as follows:
- [Email Protected]:~/data/ebook/java/j2se/jdk_gc$jps
- 6286Jps
- 6174Jstat
Jconsole of JVM Monitoring tools
A graphical interface that allows you to observe the Gc,class, memory and other information of the Java process. Although more intuitive, individuals are more inclined to use the Jstat command (Jstat is described in detail in the last section).
Jinfo of JVM Monitoring tools (unique under Linux)
Observe the running environment parameters for Java programs in operation: parameters include the Javasystem property and JVM command-line arguments
Example: jinfo2083
Where 2083 is the Java process ID number, you can use JPS to get this ID number.
The output is too much, not listed here, you can try this command yourself.
Jstack of JVM Monitoring tools (unique under Linux)
You can observe the current status of all threads in the JVM and the current state of the thread
jstack2083
The output reads as follows:
The jmap of the JVM monitoring tools (Linux-specific, also a very common command)
Observe the physical memory usage of the JVM in operation.
The parameters are as follows:
-heap: Printing the Jvmheap case
-histo: Prints the histogram of the jvmheap. Its output information includes the class name, the number of objects, and the size of the object.
-histo:live: Same as above, but only promise to survive
-permstat: Print Permanentgenerationheap case
command to use:
jmap-heap2083
Newgeneration (edenspace,fromspace,tospace), tenuredgeneration,permgeneration memory usage can be observed
Output content:
jmap-histo2083|jmap-histo:live2083
You can observe the condition of all objects in the heap (in the case of all surviving objects in the heap). Includes the number of objects and the amount of space occupied.
Output content:
Write a script that can quickly find the object that is the largest in the heap, especially effective against memory leaks.
Jstat of JVM Monitoring tools
The final point is to introduce this command. This is a more important and useful command in the JDK command, you can observe CLASSLOADER,COMPILER,GC related information, the specific parameters are as follows:
-class: Statistical ClassLoader Behavioral Information
-compile: Statistical compilation Behavior Information
-GC: Statistics JDKGC when the heap information
-gccapacity: Statistics of different generations (do not know how to translate well, including the new district, old age area, Permanent district) corresponding heap capacity situation
-gccause: Statistical GC case, (same as-gcutil) and event that caused GC
-gcnew: When statistics GC, the Cenozoic situation
-gcnewcapacity: When statistics GC, the Cenozoic heap capacity
-gcold: Statistics GC, the situation of the elderly area
-gcoldcapacity: When statistics GC, the old area heap capacity
-gcpermcapacity: When statistics GC, permanent area heap capacity
-gcutil: When statistics GC, heap condition
-printcompilation: Don't know what to do, has been useless.
JVM Monitoring Tool usage guidance