JVM Quest: jinfo view the JVM run-time parameters

This series of notes is mainly based on "in-depth understanding of the Java Virtual Machine: JVM advanced features and best practices 2nd Edition" is a book of reading notes.

How to view JVM run-time parameters for online JVM tuning it is critical, because only know JVM parameters currently used what value, in order to know how to tune.

The following parameters JVM, can be used to print the JVM runtime parameters and their values:

parameter Explanation
-XX:+PrintFlagsInitial View the initial value
-XX:+PrintFlagsFinal View the final value as the initial value may be modified
-XX:+UnlockExperimentalVMOptions Unlock experimental parameters, JVM in some experimental parameters can not be directly assigned, you must use this parameter to assign
-XX:+UnlockDiagnosticVMOptions Unlock diagnostic parameters
-XX:+PrintCommandLineFlags Print command-line parameters

For example, use the command to view the JVM parameters PrintFlagsFinal

java -XX:+PrintFlagsFinal -version

Section outputs as follows:

image

Where "="it represents the initial value ":="represents the value after the modification.
This is the command to view the execution javacommand of the current process, the official use, we usually see is the Java program process line, then, will be used JDK command line tools: jpsand jinfo.

All JDK tools are available in the official website of Oracle Java Tools Reference find use in the documentation, which is the main reference.

jps

JDK comes with some command-line tools, and Linux jps command ps, are viewing the process, but only to view the Java process jps.

格式:jps [ options ] [ hostid ]

View jpshelp information:

image

Use jpsthe command to view the local Java process:

image

The output of Bootstrapthe Tomcat process, you can use the jps -loutput to confirm that the package path:

image

Use jps -vView more of parameters:

image

jinfo

jinfo command to view the configuration of the JVM.

格式:
jinfo [ option ] pid
jinfo [ option ] executable core
jinfo [ option ] [ servier-id ] remote-hostname-or-IP

View jinfohelp information:

image

Use jinfo -flag [参数] [pid]to view the maximum Java heap:

image

See if the G1 or Parallel collector:

image

Use jinfo -flags [pid]View all modified parameter values:

image

to sum up

First through the jpsfind command to view the Java process, then use the jinfocommand you can see when you specify the parameters for running Java programs.

Guess you like

Origin www.cnblogs.com/cellei/p/12164708.html