The jinfo command of the Java virtual machine

1. Concept

     View all the parameters of the running jvm, you can also set some parameters

2. Grammar

    jinfo -help

Usage: jinfo parameter pid

Parameter description:

parameter

meaning

-flag <name>

to print the value of the named VM flag (output the parameter corresponding to the name)

-flag [+|-]<name>

to enable or disable the named VM flag (turn on or off the parameter of the corresponding name)

-flag <name>=<value>

to set the named VM flag to the given value

-flags

to print VM flags (output all parameters)

-sysprops

to print Java system properties

<no option>

to print both of the above (output all parameters and system properties)

-h | -help

to print this help message

pid: Process ID, which can be obtained through jps or ps command

Three, example

1. Check the parameter of the corresponding name: jinfo -flag MaxNewSize 121083

2. Turn on or turn off the parameter of the corresponding name:

            Turn on: jinfo -flag +PrintGC 121083

            Close: jinfo -flag -PrintGC 121083

            Check whether it is turned on: jinfo -flag PrintGC 121083

 3. Output all the parameters: jinfo -flags 121083

 4. View system properties: jinfo -sysprops 121083

parameter

meaning

-Xms

The initial heap size, the default is 1/64 of the physical memory (<1GB); the default (MinHeapFreeRatio parameter can be adjusted) when the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of -Xmx

-Xmx

The maximum heap size, the default (MaxHeapFreeRatio parameter 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 memory space size of the new generation, note: the size here is (eden+ 2 survivor space). It is different from the New gen shown in jmap -heap. The entire heap size = young generation size + old generation size + permanent generation size. Under the condition that the heap size remains unchanged, after increasing the young generation, the size of the old generation will be reduced. This value has a greater impact on system performance. Sun officially recommends a configuration of 3/8 of the entire heap.

-XX:SurvivorRatio

The capacity ratio of the Eden area to the Survivor area in the new generation, the default value is 8. The ratio of two Survivor areas to one Eden area is 2:8, and one Survivor area accounts for 1/10 of the entire young generation.

-Xss

The stack size of each thread. After JDK5.0, the stack size of each thread is 1M, and the stack size of each thread is 256K before. It should be adjusted appropriately according to the memory size required by the application thread. Under the same physical memory, reducing this value can generate more threads. However, the operating system still has a limit on the number of threads in a process, which cannot be generated indefinitely. The experience value is around 3000~5000. Generally, for small applications, if the stack is not very deep, 128k should be sufficient. For large applications, 256k is recommended. This option has a relatively large impact on performance and requires rigorous testing. Similar to the threadstacksize option explanation, the official document does not seem to explain it. There is a sentence in the forum: "-Xss is translated in a VM flag named ThreadStackSize" generally set this value.

-XX:PermSize

Set the initial value of perm gen. The default value is 1/64 of the physical memory.

-XX:MaxPermSize

Set the maximum value of persistent generation. 1/4 of physical memory.

 

Learning address: https://blog.csdn.net/yx0628/article/details/80958488

Guess you like

Origin blog.csdn.net/baidu_28068985/article/details/108279273