JVM jinfo command (Java Configuration Info) usage summary, jvmjinfo
Introduction
Jinfo is a built-in jdk command. It can be used to view the extension parameters of running Java applications, or even to modify some parameters at runtime.
Generally, jps is used to view the java Process id, and jinfo is used to view the jvm information of the specified pid.
Jps # view the virtual machine processes in the current running status through jps
View jvm Parameters
jinfo -flags process_id
View java System Parameters
jinfo -sysprops process_id
You can view the parameters of a virtual machine by running the following command:
java -XX:+PrintFlagsFinal -version | grep manageable
In addition to the startup script, you can set parameters. PrintGC is enabled by default. Therefore, you only need to open the PrintGCDetails parameter.
jinfo -flag +PrintGC 27250 jinfo -flag +PrintGCDetails 27250
To disable GC log printing, run the following command:
jinfo -flag -PrintGC 27250 jinfo -flag -PrintGCDetails 27250
Check whether GC log printing is Enabled:
jinfo -flag PrintGC 27250 jinfo -flag PrintGCDetails 27250
Common JVM Parameters
-Xms: the initial heap size. The default value is 1/64 of the physical memory (<1 GB). The default value is when the idle heap memory is less than 40%. The MinHeapFreeRatio parameter can be adjusted, the JVM will increase the heap size until the maximum limit of-Xmx: The maximum heap size. The default value is when the memory of the Free heap is greater than 70% (the MaxHeapFreeRatio parameter can be adjusted, JVM will reduce the size of heap memory until the minimum limit of-Xms-Xmn: the size of the new generation memory. Note: The size here is (eden + 2 slave vor space ). It is different from the New gen shown in jmap-heap. Total heap size = new generation size + Old Generation size + permanent generation size. When the heap size remains unchanged, increasing the new generation will reduce the size of the old generation. This value has a great impact on the system performance. Sun officially recommends 3/8 of the total heap configuration. -XX: SurvivorRatio: The capacity ratio of the Eden region in the new generation to the region vor region. The default value is 8. The ratio of two primary vor zones to One Eden zone is, and one primary vor zone accounts for 1/10 of the entire young generation. -Xss: the stack size of each thread. After JDK 256, the size of each thread stack is 1 MB, and the size of each previous thread stack is K. The memory size required by the Application Thread should be adjusted as appropriate. Reduce this value to generate more threads in the same physical memory. However, the operating system still has a limit on the number of threads in a process. It cannot be generated infinitely. The experience is between 3000 and ~ About 5000. For small applications, if the stack is not very deep, it should be 256 k enough. For large applications, k is recommended. This option has a big impact on performance and requires rigorous testing. Similar to the threadstacksize option, the official documentation does not seem to explain this. in the Forum, there is a saying: "-Xss is translated in a VM flag named ThreadStackSize". Generally, you can set this value. -XX: PermSize: sets the initial value of the permanent generation (perm gen. The default value is 1/64 of the physical memory. -XX: MaxPermSize: sets the maximum value of the persistent generation. 1/4 of the physical memory.