目录
作用:实时查看和修改JVM配置参数
C:\Users\qianqian>jinfo -h
Usage:
jinfo [option] <pid>
(to connect to running process)
jinfo [option] <executable <core>
(to connect to a core file)
jinfo [option] [server_id@]<remote server IP or hostname>
(to connect to remote debug server)
where <option> is one of:
-flag <name> to print the value of the named VM flag
-flag [+|-]<name> to enable or disable the named VM flag
-flag <name>=<value> to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
<no option> to print both of the above
-h | -help to print this help message
查看
-fiags
查看赋过值的参数
C:\Users\qianqian>jinfo -flags 8740
Attaching to process ID 8740, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.211-b12
Non-default VM flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote
-XX:CICompilerCount=3 -XX:ConcGCThreads=2 -XX:G1HeapRegionSize=1048576
-XX:InitialHeapSize=268435456 -XX:+ManagementServer -XX:MarkStackSize=4194304
-XX:MaxGCPauseMillis=100 -XX:MaxHeapSize=1073741824 -XX:MaxNewSize=643825664
-XX:MinHeapDeltaBytes=1048576 -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers
-XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC
-XX:-UseLargePagesIndividualAllocation
Command line:
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54923,suspend=y,server=n
-XX:+UseG1GC -Xmx1G -XX:MaxGCPauseMillis=100 -XX:TieredStopAtLevel=1 -Xverify:none
-Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote
-Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain
-Dspring.application.admin.enabled=true
-javaagent:C:\Users\qianqian\AppData\Local\JetBrains\IntelliJIdea2020.2\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8
-flag
查看某个参数具体的值
C:\Users\qianqian>jinfo -flag UseG1GC 8740
-XX:+UseG1GC
C:\Users\qianqian>jinfo -flag MaxHeapSize 8740
-XX:MaxHeapSize=1073741824
设置值
参数被标记为manageable的flag才可以被实时修改。其实极其有限
C:\Users\qianqian>jinfo -flag PrintGCDetails 8740
-XX:-PrintGCDetails
C:\Users\qianqian>jinfo -flag +PrintGCDetails 8740
C:\Users\qianqian>jinfo -flag PrintGCDetails 8740
-XX:+PrintGCDetails
C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio 8740
-XX:MaxHeapFreeRatio=70
C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio=100 8740
C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio 8740
-XX:MaxHeapFreeRatio=100
扩展
java -XX:+PrintFlagsFinal
C:\Users\qianqian>java -XX:+PrintFlagsFinal > 1.txt