首页 » 语言&开发 » Java » JVM参数与工具

JVM参数与工具

 

查看JVM所有可设置参数及默认值

  • -XX:+PrintFlagsInitial
java -XX:+PrintFlagsInitial | more
[Global flags]
    uintx AdaptivePermSizeWeight                    = 20              {product}
    uintx AdaptiveSizeDecrementScaleFactor          = 4               {product}
    uintx AdaptiveSizeMajorGCDecayTimeScale         = 10              {product}
    uintx AdaptiveSizePausePolicy                   = 0               {product}
    uintx AdaptiveSizePolicyCollectionCostMargin    = 50              {product}
    uintx AdaptiveSizePolicyInitializingSteps       = 20              {product}
    uintx AdaptiveSizePolicyOutputInterval          = 0               {product}
    uintx AdaptiveSizePolicyWeight                  = 10              {product}
    uintx AdaptiveSizeThroughPutPolicy              = 0               {product}
    uintx AdaptiveTimeWeight                        = 25              {product}
     bool AdjustConcurrency                         = false           {product}
     bool AggressiveOpts                            = false           {product}
     intx AliasLevel                                = 3               {C2 product}
     bool AlignVector                               = true            {C2 product}
     intx AllocateInstancePrefetchLines             = 1               {product}
     intx AllocatePrefetchDistance                  = -1              {product}
     intx AllocatePrefetchInstr                     = 0               {product}
     intx AllocatePrefetchLines                     = 3               {product}
     intx AllocatePrefetchStepSize                  = 16              {product}
     intx AllocatePrefetchStyle                     = 1               {product}

查看JVM设置的参数值

  • -XX:+PrintFlagsFinal
java -XX:+PrintFlagsInitial | more
[Global flags]
    uintx AdaptivePermSizeWeight                    = 20              {product}
    uintx AdaptiveSizeDecrementScaleFactor          = 4               {product}
    uintx AdaptiveSizeMajorGCDecayTimeScale         = 10              {product}
    uintx AdaptiveSizePausePolicy                   = 0               {product}
    uintx AdaptiveSizePolicyCollectionCostMargin    = 50              {product}
    uintx AdaptiveSizePolicyInitializingSteps       = 20              {product}
    uintx AdaptiveSizePolicyOutputInterval          = 0               {product}
    uintx AdaptiveSizePolicyWeight                  = 10              {product}
    uintx AdaptiveSizeThroughPutPolicy              = 0               {product}
    uintx AdaptiveTimeWeight                        = 25              {product}
     bool AdjustConcurrency                         = false           {product}
     bool AggressiveOpts                            = false           {product}
     intx AliasLevel                                = 3               {C2 product}
     bool AlignVector                               = true            {C2 product}
     intx AllocateInstancePrefetchLines             = 1               {product}
     intx AllocatePrefetchDistance                  = -1              {product}
     intx AllocatePrefetchInstr                     = 0               {product}
     intx AllocatePrefetchLines                     = 3               {product}
     intx AllocatePrefetchStepSize                  = 16              {product}
     intx AllocatePrefetchStyle                     = 1               {product}
     bool AllowJNIEnvProxy                          = false           {product}
     bool AllowNonVirtualCalls                      = false           {product}
     bool AllowParallelDefineClass                  = false           {product}

指定pid查看指定参数设置值

  • jinfo

jinfo -flag MaxPermSize 2271 -XX:MaxPermSize=2147483648

查看指定pid所有设定值

jinfo -flags 2271

Attaching to process ID 2271, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.60-b09

-Djava.util.logging.config.file=/opt/deploy/qa-xxx/apache-tomcat-7.0.55/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8 -Dsun.security.ssl.allowUnsafeRenegotiation=true -Xms2048m -Xmx4096m -XX:MaxNewSize=2048m -XX:MaxPermSize=2048m -Dnetworkaddress.cache.ttl=1800 -Dsun.net.inetaddr.ttl=1800 -Djava.endorsed.dirs=/opt/deploy/qa-xxx/apache-tomcat-7.0.55/endorsed -Dcatalina.base=/opt/deploy/qa-xxx/apache-tomcat-7.0.55 -Dcatalina.home=/opt/deploy/qa-xxx/apache-tomcat-7.0.55 -Djava.io.tmpdir=/opt/deploy/qa-xxx/apache-tomcat-7.0.55/temp

查看已配置过的JVM参数

java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=790550912 -XX:MaxHeapSize=12648814592 -XX:+PrintCommandLineFlags -XX:+UseCompressedOops -XX:+UseParallelGC


原文链接:JVM参数与工具,转载请注明来源!

0