Brief introduction
Jinfo is a JDK-brought command that can be used to view the extended parameters of a running Java application, or even to modify some parameters at run time.
You will typically use JPS to view the Java process ID, and then use Jinfo to view the JVM information for the specified PID.
JPS #通过jps来查看当前运行状态的虚拟机进程
To view the parameters of the JVM
Jinfo-flags process_id
View Java System parameters
Jinfo-sysprops process_id
These parameters of the virtual machine can be viewed by the following command:
java-xx:+printflagsfinal-version | grep manageable
In addition to setting parameters through the startup script, PRINTGC is turned on by default, so we only need to open the Printgcdetails parameter.
Jinfo-flag +PRINTGC 27250 jinfo-flag +printgcdetails 27250
If you need to turn off the printing of GC logs, use the following command:
JINFO-FLAG-PRINTGC 27250 jinfo-flag-printgcdetails 27250
Check to see if GC log printing is turned on:
Jinfo-flag PRINTGC 27250 jinfo-flag printgcdetails 27250
Common JVM Parameters
-XMS: Initial heap size, default is physical memory 1/64 (<1GB), default (minheapfreeratio parameter can be adjusted) when the free heap memory is less than 40%, the JVM will increase the heap until the maximum-xmx limit-xmx: Maximum heap size, default ( Maxheapfreeratio parameters can be adjusted) when the free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of-XMS-xmn: The amount of new generation of memory space, note: The size here is (eden+ 2 survivor space). is different from the new Gen shown in Jmap-heap. Entire Heap size = Cenozoic size + Laosheng generation size + permanent generation size. If the size of the heap is not changed, the Laosheng will be reduced after the new generation is enlarged. This value has a large impact on system performance, and Sun's official recommendation is 3/8 for the entire heap. -xx:survivorratio: The capacity ratio of the Eden region to the survivor region in the Cenozoic, with a default value of 8. The ratio of two survivor to one Eden area was 2:8, and one survivor area accounted for 1/10 of the entire young generation. -XSS: The stack size of each thread. After JDK5.0, each thread has a stack size of 1M, before each thread has a stack size of 256K. Appropriate adjustments should be made to the size of the memory required by the application's thread. In the same physical memory, reducing this value can generate more threads. However, the operating system of the number of threads within a process is still limited, can not be generated indefinitely, the empirical value of 3000~5000 around. General small application, if the stack is not very deep, should be 128k enough, large applications recommend the use of 256k. This option has a large impact on performance and requires rigorous testing. Similar to the Threadstacksize option interpretation, the official documentation does not seem to explain the phrase in the Forum: "-XSS is translated in a VM flag named threadstacksize" This value is generally set. -xx:permsize: Sets the permanent generation (Perm Gen) initial value. The default value is 1/64 of physical memory. -xx:maxpermsize: Sets the maximum number of persistent generations. 1/4 of physical memory.
JVM jinfo Command (Java Configuration Info) Usage Summary