What Are the Default HotSpot JVM Values
来源:互联网 发布:js和jquery应用 编辑:程序博客网 时间:2024/06/05 02:23
What Are the Default HotSpot JVM Values?
Updated (09/16/2014):
In the latest JDK 8 releases, it only prints out product level options if you use, say, -XX:+PrintFlagsFinal. To print other options, you could do something like this:
Oftentimes you will find the needs to understand better the options provided by Oracle's (formerly Sun's) HotSpot Java Virtual Machine. For example, when you try to tune the performance of Java applications, you definitively want to know what JVM parameter values are chosen by default. From the defaults, you might start fine-tuning their values based on your application's characteristics.
There are two JVM options which can be useful to you:
For example, if PrintFlagsFinal is specified, at the beginning of the WebLogic server log file, you can find:
In case you wonder what "x" means in the types intx and uintx, intx and uintx are the 'extended' int and 'extended' unsigned int types—They are 32bit wide on a 32-bit platform and 64bit wide on a 64bit platform.
The last value from the output specifies the scope of parameter, or when it can be used. For example, if the value is
Similarly, you can provide
Finally, if flags are marked as manageable, they are dynamically writeable through the JDK management interface (com.sun.management.HotSpotDiagnosticMXBean API) and also through JConsole. The manageable flags can also be set through jinfo -flag.
We know the scope of UseCriticalJavaThreadPriority parameter is experimental. If we set it without specifying -XX:+UnlockExperimentalVMOptions first, here is the result:
Finally, remember to add -version at the end as shown here:
$jdk-hs/bin/java -server -XX:+PrintFlagsFinal -XX:+UseSerialGC -version >tmp5.txt
For example, if you specified options in this order, it would ignore -XX:+UseSerialGC setting:
$jdk-hs/bin/java -server -XX:+PrintFlagsFinal -version -XX:+UseSerialGC >tmp6.txt
For JRockit, you use:
In the latest JDK 8 releases, it only prints out product level options if you use, say, -XX:+PrintFlagsFinal. To print other options, you could do something like this:
../bin/java -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions
-XX:+UnlockDiagnosticVMOptions -version
Oftentimes you will find the needs to understand better the options provided by Oracle's (formerly Sun's) HotSpot Java Virtual Machine. For example, when you try to tune the performance of Java applications, you definitively want to know what JVM parameter values are chosen by default. From the defaults, you might start fine-tuning their values based on your application's characteristics.
There are two JVM options which can be useful to you:
- -XX:+PrintFlagsInitial
- -XX:+PrintFlagsFinal
-XX:+PrintFlagsFinal
For example, if PrintFlagsFinal is specified, at the beginning of the WebLogic server log file, you can find:
starting weblogic with Java version:java version "1.7.0_04-ea"Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b17)Java HotSpot(TM) 64-Bit Server VM (build 23.0-b18, mixed mode)Starting WLS with line:/export/home/bench/workload/target_jvm/jdk-hs/bin/java -server -Xms6400m -Xmx6400m -XX:+AggressiveOpts ...[Global flags] uintx AdaptivePermSizeWeight = 20 {product} uintx AdaptiveSizeDecrementScaleFactor = 4 {product} uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} uintx AdaptiveSizePausePolicy = 0 {product} ... uintx MinHeapFreeRatio = 0 {manageable} uintx MaxHeapFreeRatio = 100 {manageable} intx WorkAroundNPTLTimedWaitHang = 1 {product} uintx WorkStealingHardSpins = 4096 {experimental} intx WorkStealingSleepMillis = 1 {experimental} uintx WorkStealingSpinToYieldRatio = 10 {experimental} uintx WorkStealingYieldsBeforeSleep = 5000 {experimental} uintx YoungGenerationSizeIncrement = 20 {product} uintx YoungGenerationSizeSupplement = 80 {product} uintx YoungGenerationSizeSupplementDecay = 8 {product} uintx YoungPLABSize = 1024 {product} bool ZeroTLAB = false {product} intx hashCode = 0 {product}
In case you wonder what "x" means in the types intx and uintx, intx and uintx are the 'extended' int and 'extended' unsigned int types—They are 32bit wide on a 32-bit platform and 64bit wide on a 64bit platform.
Parameter Scope
The last value from the output specifies the scope of parameter, or when it can be used. For example, if the value is
- {experimental}
- -XX:+UnlockExperimentalVMOptions
Similarly, you can provide
- -XX:+UnlockDiagnosticVMOptions
- {C1 diagnostic} or
- {C2 diagnostic}
Finally, if flags are marked as manageable, they are dynamically writeable through the JDK management interface (com.sun.management.HotSpotDiagnosticMXBean API) and also through JConsole. The manageable flags can also be set through jinfo -flag.
Test
We know the scope of UseCriticalJavaThreadPriority parameter is experimental. If we set it without specifying -XX:+UnlockExperimentalVMOptions first, here is the result:
$ /export/home/bench/workload/target_jvm/jdk-hs/bin/java -server -XX:+PrintFlagsFinal -XX:+UseCriticalJavaThreadPriority -version >tmp.tmpUnrecognized VM option 'UseCriticalJavaThreadPriority'Error: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Program will exit.However, if you add -XX:+UnlockExperimentalVMOptions, you will be allowed to set its value :
$ /export/home/bench/workload/target_jvm/jdk-hs/bin/java -server -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCriticalJavaThreadPriority -version >tmp.tmpjava version "1.7.0_04-ea"Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b17)Java HotSpot(TM) 64-Bit Server VM (build 23.0-b18, mixed mode)
Finally, remember to add -version at the end as shown here:
$jdk-hs/bin/java -server -XX:+PrintFlagsFinal -XX:+UseSerialGC -version >tmp5.txt
For example, if you specified options in this order, it would ignore -XX:+UseSerialGC setting:
$jdk-hs/bin/java -server -XX:+PrintFlagsFinal -version -XX:+UseSerialGC >tmp6.txt
How about JRockit?
For JRockit, you use:
- ./java -Xprintflags -version
Notes
- {pd product} means platform dependent
References
- HotSpot JVM Options Displayed: -XX:+PrintFlagsInitial and -XX:+PrintFlagsFinal
- Inspecting HotSpot JVM Options
- Redux: Inspecting HotSpot JVM Options
- Oracle® JRockit Command-Line Reference Release R28
- Default Values of JRockit's VM Options (XML and More)
- HotSpot Glossary of Terms
0 0
- What Are the Default HotSpot JVM Values
- What are the phases of the maven default lifecycle?
- What are the phases of the maven default lifecycle?
- The default values for java data types:
- What are the clusters? What are their advantages?
- What is the purpose of /etc/default?
- HotSpot JVM
- JVM--hotspot
- What are the Types of Inforecords
- what the hell are you doing? SqLite...
- What Are the Gmail Exchange ActiveSync Settings?
- What are the process states in UNIX?
- What are the Microsoft Office MIME Types
- What are the objects in oracle?
- What Are the Tree Table Names
- What are the __init* and __exit* macros ?
- What are the best study methods?
- What are the Best Study Methods?
- svn不能上传*.so包的问题
- Source Insight
- mysqldump常用参数
- Java基础之内部类
- 关于ExtJs智能联想输入框的实现方法
- What Are the Default HotSpot JVM Values
- jQuery中的Ajax几种请求方法
- 数据结构实验之图论七:驴友计划
- VideoView的简单使用(二)
- SQL笔记(4)_第四章 规格化过程
- omnipeek 5.1 破解版,亲测可用 win7
- CSS入门(7)-Font和行高Line Height
- opencv:找到opencv官方的使用说明
- ftp上传工具类