HotSpot JVM常用参数(选项)设置即JVM参数设置实践
本文讨论的选项是针对HotSpot虚拟机的。
1、选项分类及语法
HotspotJVM提供以下三大类选项:
1.1、标准选项
这类选项的功能是很稳定的,在后续版本中也不太会发生变化。
运行java或者 java -help 可以看到所有的标准选项。
语法:所有的标准选项都是以 - 开头,比如-version,-server等。
1.2、X选项
这类选项的功能还是很稳定,但官方的说法是它们的行为可能会在后续版本中改变,也有可能不在后续版本中提供了.
运行 java -X 命令可以看到所有的X选项。
语法:这类选项都是以 -X 开头,比如-Xms。
1.3、XX选项
这类选项是属于实验性,主要是给JVM开发者用于开发和调试JVM的,在后续的版本中行为有可能会变化。
语法:
- 如果是布尔类型的选项,它的格式为-XX:+flag或者-XX:-flag,分别表示开启和关闭该选项。
- 针对非布尔类型的选项,它的格式为-XX:flag=value
2、常用配置
2.1、指定JVM运行模式
Hotspot JVM有两种类型,分别是server和client。
它们的区别是Server VM的初始堆空间会大一些,默认使用的是并行垃圾回收器,启动慢运行快。Client VM相对来讲会保守一些,初始堆空间会小一些,使用串行的垃圾回收器,它的目标是为了让JVM的启动速度更快,但运行速度会比Server模式慢些。
JVM在启动的时候会根据硬件和操作系统自动选择使用Server还是Client类型的JVM。
- 在32位Windows系统上,不论硬件配置如何,都默认使用Client类型的JVM。
- 在其他32位操作系统上,如果机器配置有2GB以上的内存同时有2个以上的CPU,则默认会使用Server类型的JVM
- 64位机器上只有Server类型的JVM。也就是说Client类型的JVM只在32位机器上提供。
- 也可以使用-server和-client选项来指定JVM的类型,不过只在32位的机器上有效,原因见上面一条。
更多详细内容可参见:http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
2.2、指定JIT编译器模式
Java是一种解释型语言,但随着JIT技术的进步,它能在运行时将Java的字节码编译成本地代码。以下是几个相关的选项:
- -Xint表示禁用JIT,所有字节码都被解释执行,这个模式的速度最慢的。
- -Xcomp表示所有字节码都首先被编译成本地代码,然后再执行。
- -Xmixed,默认模式,让JIT根据程序运行的情况,有选择地将某些代码编译成本地代码。
-Xcomp和-Xmixed到底谁的速度快,针对不同的程序可能有不同的结果,基本还是推荐用默认模式。
2.3、查看Java版本
-version和-showversion
-version用于查看当前的 Java版本、JRE版本、JVM类型和版本。结果示例如下:
C:\Users\zsm>java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
-showversion的作用是在运行一个程序时首先把上述信息打印出来,这样便于问题诊断。如 java -showversion ExptoolMain
建议Server类型的程序都把-showversion选项打开,这样可以发现一些配置问题,比如程序需要JDK1.7才能运行,而有的机器上装有多个JDK的版本,打开这个选项可以避免使用了错误版本的Java。
2.4、打印设置的XX选项及值
有三个选项:-XX:+PrintCommandLineFlags、-XX:+PrintFlagsInitial、-XX:+PrintFlagsFinal
-XX:+PrintCommandLineFlags:与-showversion类似,此选项可以在程序运行时首先打印出用户手动设置或者JVM自动设置的XX选项,建议加上这个选项以辅助问题诊断。
如下示例显示了JVM自动配置的初始和最大的HeapSize以及其他的一些选项:
C:\Users\zsm>java -XX:+PrintCommandLineFlags -version -XX:InitialHeapSize=132712832 -XX:MaxHeapSize=2123405312 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
从输出内容中的 “-XX:+UseParallelGC” 可见 Server模式下默认用的垃圾收集器类型。
-XX:+PrintFlagsInitial:表示打印出所有XX选项的默认值。示例如下:
1 C:\Users\zsm>java -XX:+PrintFlagsInitial -version 2 [Global flags] 3 uintx AdaptiveSizeDecrementScaleFactor = 4 {product} 4 uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} 5 uintx AdaptiveSizePausePolicy = 0 {product} 6 uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product} 7 uintx AdaptiveSizePolicyInitializingSteps = 20 {product} 8 uintx AdaptiveSizePolicyOutputInterval = 0 {product} 9 uintx AdaptiveSizePolicyWeight = 10 {product} 10 uintx AdaptiveSizeThroughPutPolicy = 0 {product} 11 uintx AdaptiveTimeWeight = 25 {product} 12 bool AdjustConcurrency = false {product} 13 bool AggressiveOpts = false {product} 14 intx AliasLevel = 3 {C2 product} 15 bool AlignVector = true {C2 product} 16 intx AllocateInstancePrefetchLines = 1 {product} 17 intx AllocatePrefetchDistance = -1 {product} 18 intx AllocatePrefetchInstr = 0 {product} 19 intx AllocatePrefetchLines = 3 {product} 20 intx AllocatePrefetchStepSize = 16 {product} 21 intx AllocatePrefetchStyle = 1 {product} 22 bool AllowJNIEnvProxy = false {product} 23 bool AllowNonVirtualCalls = false {product} 24 bool AllowParallelDefineClass = false {product} 25 bool AllowUserSignalHandlers = false {product} 26 bool AlwaysActAsServerClassMachine = false {product} 27 bool AlwaysCompileLoopMethods = false {product} 28 bool AlwaysLockClassLoader = false {product} 29 bool AlwaysPreTouch = false {product} 30 bool AlwaysRestoreFPU = false {product} 31 bool AlwaysTenure = false {product} 32 bool AssertOnSuspendWaitFailure = false {product} 33 bool AssumeMP = false {product} 34 intx AutoBoxCacheMax = 128 {C2 product} 35 uintx AutoGCSelectPauseMillis = 5000 {product} 36 intx BCEATraceLevel = 0 {product} 37 intx BackEdgeThreshold = 100000 {pd product} 38 bool BackgroundCompilation = true {pd product} 39 uintx BaseFootPrintEstimate = 268435456 {product} 40 intx BiasedLockingBulkRebiasThreshold = 20 {product} 41 intx BiasedLockingBulkRevokeThreshold = 40 {product} 42 intx BiasedLockingDecayTime = 25000 {product} 43 intx BiasedLockingStartupDelay = 4000 {product} 44 bool BindGCTaskThreadsToCPUs = false {product} 45 bool BlockLayoutByFrequency = true {C2 product} 46 intx BlockLayoutMinDiamondPercentage = 20 {C2 product} 47 bool BlockLayoutRotateLoops = true {C2 product} 48 bool BranchOnRegister = false {C2 product} 49 bool BytecodeVerificationLocal = false {product} 50 bool BytecodeVerificationRemote = true {product} 51 bool C1OptimizeVirtualCallProfiling = true {C1 product} 52 bool C1ProfileBranches = true {C1 product} 53 bool C1ProfileCalls = true {C1 product} 54 bool C1ProfileCheckcasts = true {C1 product} 55 bool C1ProfileInlinedCalls = true {C1 product} 56 bool C1ProfileVirtualCalls = true {C1 product} 57 bool C1UpdateMethodData = true {C1 product} 58 intx CICompilerCount = 2 {product} 59 bool CICompilerCountPerCPU = false {product} 60 bool CITime = false {product} 61 bool CMSAbortSemantics = false {product} 62 uintx CMSAbortablePrecleanMinWorkPerIteration = 100 {product} 63 intx CMSAbortablePrecleanWaitMillis = 100 {manageable} 64 uintx CMSBitMapYieldQuantum = 10485760 {product} 65 uintx CMSBootstrapOccupancy = 50 {product} 66 bool CMSClassUnloadingEnabled = true {product} 67 uintx CMSClassUnloadingMaxInterval = 0 {product} 68 bool CMSCleanOnEnter = true {product} 69 bool CMSCompactWhenClearAllSoftRefs = true {product} 70 uintx CMSConcMarkMultiple = 32 {product} 71 bool CMSConcurrentMTEnabled = true {product} 72 uintx CMSCoordinatorYieldSleepCount = 10 {product} 73 bool CMSDumpAtPromotionFailure = false {product} 74 bool CMSEdenChunksRecordAlways = true {product} 75 uintx CMSExpAvgFactor = 50 {product} 76 bool CMSExtrapolateSweep = false {product} 77 uintx CMSFullGCsBeforeCompaction = 0 {product} 78 uintx CMSIncrementalDutyCycle = 10 {product} 79 uintx CMSIncrementalDutyCycleMin = 0 {product} 80 bool CMSIncrementalMode = false {product} 81 uintx CMSIncrementalOffset = 0 {product} 82 bool CMSIncrementalPacing = true {product} 83 uintx CMSIncrementalSafetyFactor = 10 {product} 84 uintx CMSIndexedFreeListReplenish = 4 {product} 85 intx CMSInitiatingOccupancyFraction = -1 {product} 86 uintx CMSIsTooFullPercentage = 98 {product} 87 double CMSLargeCoalSurplusPercent = 0.950000 {product} 88 double CMSLargeSplitSurplusPercent = 1.000000 {product} 89 bool CMSLoopWarn = false {product} 90 uintx CMSMaxAbortablePrecleanLoops = 0 {product} 91 intx CMSMaxAbortablePrecleanTime = 5000 {product} 92 uintx CMSOldPLABMax = 1024 {product} 93 uintx CMSOldPLABMin = 16 {product} 94 uintx CMSOldPLABNumRefills = 4 {product} 95 uintx CMSOldPLABReactivityFactor = 2 {product} 96 bool CMSOldPLABResizeQuicker = false {product} 97 uintx CMSOldPLABToleranceFactor = 4 {product} 98 bool CMSPLABRecordAlways = true {product} 99 uintx CMSParPromoteBlocksToClaim = 16 {product} 100 bool CMSParallelInitialMarkEnabled = true {product} 101 bool CMSParallelRemarkEnabled = true {product} 102 bool CMSParallelSurvivorRemarkEnabled = true {product} 103 uintx CMSPrecleanDenominator = 3 {product} 104 uintx CMSPrecleanIter = 3 {product} 105 uintx CMSPrecleanNumerator = 2 {product} 106 bool CMSPrecleanRefLists1 = true {product} 107 bool CMSPrecleanRefLists2 = false {product} 108 bool CMSPrecleanSurvivors1 = false {product} 109 bool CMSPrecleanSurvivors2 = true {product} 110 uintx CMSPrecleanThreshold = 1000 {product} 111 bool CMSPrecleaningEnabled = true {product} 112 bool CMSPrintChunksInDump = false {product} 113 bool CMSPrintEdenSurvivorChunks = false {product} 114 bool CMSPrintObjectsInDump = false {product} 115 uintx CMSRemarkVerifyVariant = 1 {product} 116 bool CMSReplenishIntermediate = true {product} 117 uintx CMSRescanMultiple = 32 {product} 118 uintx CMSSamplingGrain = 16384 {product} 119 bool CMSScavengeBeforeRemark = false {product} 120 uintx CMSScheduleRemarkEdenPenetration = 50 {product} 121 uintx CMSScheduleRemarkEdenSizeThreshold = 2097152 {product} 122 uintx CMSScheduleRemarkSamplingRatio = 5 {product} 123 double CMSSmallCoalSurplusPercent = 1.050000 {product} 124 double CMSSmallSplitSurplusPercent = 1.100000 {product} 125 bool CMSSplitIndexedFreeListBlocks = true {product} 126 intx CMSTriggerInterval = -1 {manageable} 127 uintx CMSTriggerRatio = 80 {product} 128 intx CMSWaitDuration = 2000 {manageable} 129 uintx CMSWorkQueueDrainThreshold = 10 {product} 130 bool CMSYield = true {product} 131 uintx CMSYieldSleepCount = 0 {product} 132 uintx CMSYoungGenPerWorker = 67108864 {pd product} 133 uintx CMS_FLSPadding = 1 {product} 134 uintx CMS_FLSWeight = 75 {product} 135 uintx CMS_SweepPadding = 1 {product} 136 uintx CMS_SweepTimerThresholdMillis = 10 {product} 137 uintx CMS_SweepWeight = 75 {product} 138 bool CheckEndorsedAndExtDirs = false {product} 139 bool CheckJNICalls = false {product} 140 bool ClassUnloading = true {product} 141 bool ClassUnloadingWithConcurrentMark = true {product} 142 intx ClearFPUAtPark = 0 {product} 143 bool ClipInlining = true {product} 144 uintx CodeCacheExpansionSize = 65536 {pd product} 145 uintx CodeCacheMinimumFreeSpace = 512000 {product} 146 bool CollectGen0First = false {product} 147 bool CompactFields = true {product} 148 intx CompilationPolicyChoice = 0 {product} 149 ccstrlist CompileCommand = {product} 150 ccstr CompileCommandFile = {product} 151 ccstrlist CompileOnly = {product} 152 intx CompileThreshold = 10000 {pd product} 153 bool CompilerThreadHintNoPreempt = true {product} 154 intx CompilerThreadPriority = -1 {product} 155 intx CompilerThreadStackSize = 0 {pd product} 156 uintx CompressedClassSpaceSize = 1073741824 {product} 157 uintx ConcGCThreads = 0 {product} 158 intx ConditionalMoveLimit = 3 {C2 pd product} 159 intx ContendedPaddingWidth = 128 {product} 160 bool ConvertSleepToYield = true {pd product} 161 bool ConvertYieldToSleep = false {product} 162 bool CreateMinidumpOnCrash = false {product} 163 bool CriticalJNINatives = true {product} 164 bool DTraceAllocProbes = false {product} 165 bool DTraceMethodProbes = false {product} 166 bool DTraceMonitorProbes = false {product} 167 bool Debugging = false {product} 168 uintx DefaultMaxRAMFraction = 4 {product} 169 intx DefaultThreadPriority = -1 {product} 170 intx DeferPollingPageLoopCount = -1 {product} 171 intx DeferThrSuspendLoopCount = 4000 {product} 172 bool DeoptimizeRandom = false {product} 173 bool DisableAttachMechanism = false {product} 174 bool DisableExplicitGC = false {product} 175 bool DisplayVMOutputToStderr = false {product} 176 bool DisplayVMOutputToStdout = false {product} 177 bool DoEscapeAnalysis = true {C2 product} 178 bool DontCompileHugeMethods = true {product} 179 bool DontYieldALot = false {pd product} 180 ccstr DumpLoadedClassList = {product} 181 bool DumpReplayDataOnError = true {product} 182 bool DumpSharedSpaces = false {product} 183 bool EagerXrunInit = false {product} 184 intx EliminateAllocationArraySizeLimit = 64 {C2 product} 185 bool EliminateAllocations = true {C2 product} 186 bool EliminateAutoBox = true {C2 product} 187 bool EliminateLocks = true {C2 product} 188 bool EliminateNestedLocks = true {C2 product} 189 intx EmitSync = 0 {product} 190 bool EnableContended = true {product} 191 bool EnableSharedLookupCache = true {product} 192 bool EnableTracing = false {product} 193 uintx ErgoHeapSizeLimit = 0 {product} 194 ccstr ErrorFile = {product} 195 ccstr ErrorReportServer = {product} 196 double EscapeAnalysisTimeout = 20.000000 {C2 product} 197 bool EstimateArgEscape = true {product} 198 bool ExplicitGCInvokesConcurrent = false {product} 199 bool ExplicitGCInvokesConcurrentAndUnloadsClasses = false {product} 200 bool ExtendedDTraceProbes = false {product} 201 ccstr ExtraSharedClassListFile = {product} 202 bool FLSAlwaysCoalesceLarge = false {product} 203 uintx FLSCoalescePolicy = 2 {product} 204 double FLSLargestBlockCoalesceProximity = 0.990000 {product} 205 bool FailOverToOldVerifier = true {product} 206 bool FastTLABRefill = true {product} 207 intx FenceInstruction = 0 {ARCH product} 208 intx FieldsAllocationStyle = 1 {product} 209 bool FilterSpuriousWakeups = true {product} 210 ccstr FlightRecorderOptions = {product} 211 bool ForceNUMA = false {product} 212 bool ForceTimeHighResolution = false {product} 213 intx FreqInlineSize = 325 {pd product} 214 double G1ConcMarkStepDurationMillis = 10.000000 {product} 215 uintx G1ConcRSHotCardLimit = 4 {product} 216 uintx G1ConcRSLogCacheSize = 10 {product} 217 intx G1ConcRefinementGreenZone = 0 {product} 218 intx G1ConcRefinementRedZone = 0 {product} 219 intx G1ConcRefinementServiceIntervalMillis = 300 {product} 220 uintx G1ConcRefinementThreads = 0 {product} 221 intx G1ConcRefinementThresholdStep = 0 {product} 222 intx G1ConcRefinementYellowZone = 0 {product} 223 uintx G1ConfidencePercent = 50 {product} 224 uintx G1HeapRegionSize = 0 {product} 225 uintx G1HeapWastePercent = 5 {product} 226 uintx G1MixedGCCountTarget = 8 {product} 227 intx G1RSetRegionEntries = 0 {product} 228 uintx G1RSetScanBlockSize = 64 {product} 229 intx G1RSetSparseRegionEntries = 0 {product} 230 intx G1RSetUpdatingPauseTimePercent = 10 {product} 231 intx G1RefProcDrainInterval = 10 {product} 232 uintx G1ReservePercent = 10 {product} 233 uintx G1SATBBufferEnqueueingThresholdPercent = 60 {product} 234 intx G1SATBBufferSize = 1024 {product} 235 intx G1UpdateBufferSize = 256 {product} 236 bool G1UseAdaptiveConcRefinement = true {product} 237 uintx GCDrainStackTargetSize = 64 {product} 238 uintx GCHeapFreeLimit = 2 {product} 239 uintx GCLockerEdenExpansionPercent = 5 {product} 240 bool GCLockerInvokesConcurrent = false {product} 241 uintx GCLogFileSize = 8192 {product} 242 uintx GCPauseIntervalMillis = 0 {product} 243 uintx GCTaskTimeStampEntries = 200 {product} 244 uintx GCTimeLimit = 98 {product} 245 uintx GCTimeRatio = 99 {product} 246 uintx HeapBaseMinAddress = 2147483648 {pd product} 247 bool HeapDumpAfterFullGC = false {manageable} 248 bool HeapDumpBeforeFullGC = false {manageable} 249 bool HeapDumpOnOutOfMemoryError = false {manageable} 250 ccstr HeapDumpPath = {manageable} 251 uintx HeapFirstMaximumCompactionCount = 3 {product} 252 uintx HeapMaximumCompactionInterval = 20 {product} 253 uintx HeapSizePerGCThread = 87241520 {product} 254 bool IgnoreEmptyClassPaths = false {product} 255 bool IgnoreUnrecognizedVMOptions = false {product} 256 uintx IncreaseFirstTierCompileThresholdAt = 50 {product} 257 bool IncrementalInline = true {C2 product} 258 uintx InitialBootClassLoaderMetaspaceSize = 4194304 {product} 259 uintx InitialCodeCacheSize = 2555904 {pd product} 260 uintx InitialHeapSize = 0 {product} 261 uintx InitialRAMFraction = 64 {product} 262 uintx InitialSurvivorRatio = 8 {product} 263 uintx InitialTenuringThreshold = 7 {product} 264 uintx InitiatingHeapOccupancyPercent = 45 {product} 265 bool Inline = true {product} 266 ccstr InlineDataFile = {product} 267 intx InlineSmallCode = 1000 {pd product} 268 bool InlineSynchronizedMethods = true {C1 product} 269 bool InsertMemBarAfterArraycopy = true {C2 product} 270 intx InteriorEntryAlignment = 16 {C2 pd product} 271 intx InterpreterProfilePercentage = 33 {product} 272 bool JNIDetachReleasesMonitors = true {product} 273 bool JavaMonitorsInStackTrace = true {product} 274 intx JavaPriority10_To_OSPriority = -1 {product} 275 intx JavaPriority1_To_OSPriority = -1 {product} 276 intx JavaPriority2_To_OSPriority = -1 {product} 277 intx JavaPriority3_To_OSPriority = -1 {product} 278 intx JavaPriority4_To_OSPriority = -1 {product} 279 intx JavaPriority5_To_OSPriority = -1 {product} 280 intx JavaPriority6_To_OSPriority = -1 {product} 281 intx JavaPriority7_To_OSPriority = -1 {product} 282 intx JavaPriority8_To_OSPriority = -1 {product} 283 intx JavaPriority9_To_OSPriority = -1 {product} 284 bool LIRFillDelaySlots = false {C1 pd product} 285 uintx LargePageHeapSizeThreshold = 134217728 {product} 286 uintx LargePageSizeInBytes = 0 {product} 287 bool LazyBootClassLoader = true {product} 288 intx LiveNodeCountInliningCutoff = 40000 {C2 product} 289 bool LogCommercialFeatures = false {product} 290 intx LoopMaxUnroll = 16 {C2 product} 291 intx LoopOptsCount = 43 {C2 product} 292 intx LoopUnrollLimit = 60 {C2 pd product} 293 intx LoopUnrollMin = 4 {C2 product} 294 bool LoopUnswitching = true {C2 product} 295 bool ManagementServer = false {product} 296 uintx MarkStackSize = 4194304 {product} 297 uintx MarkStackSizeMax = 536870912 {product} 298 uintx MarkSweepAlwaysCompactCount = 4 {product} 299 uintx MarkSweepDeadRatio = 5 {product} 300 intx MaxBCEAEstimateLevel = 5 {product} 301 intx MaxBCEAEstimateSize = 150 {product} 302 uintx MaxDirectMemorySize = 0 {product} 303 bool MaxFDLimit = true {product} 304 uintx MaxGCMinorPauseMillis = 4294967295 {product} 305 uintx MaxGCPauseMillis = 4294967295 {product} 306 uintx MaxHeapFreeRatio = 70 {manageable} 307 uintx MaxHeapSize = 130862280 {product} 308 intx MaxInlineLevel = 9 {product} 309 intx MaxInlineSize = 35 {product} 310 intx MaxJNILocalCapacity = 65536 {product} 311 intx MaxJavaStackTraceDepth = 1024 {product} 312 intx MaxJumpTableSize = 65000 {C2 product} 313 intx MaxJumpTableSparseness = 5 {C2 product} 314 intx MaxLabelRootDepth = 1100 {C2 product} 315 intx MaxLoopPad = 15 {C2 product} 316 uintx MaxMetaspaceExpansion = 5452592 {product} 317 uintx MaxMetaspaceFreeRatio = 70 {product} 318 uintx MaxMetaspaceSize = 4294967295 {product} 319 uintx MaxNewSize = 4294967295 {product} 320 intx MaxNodeLimit = 80000 {C2 product} 321 uint64_t MaxRAM = 0 {pd product} 322 uintx MaxRAMFraction = 4 {product} 323 intx MaxRecursiveInlineLevel = 1 {product} 324 uintx MaxTenuringThreshold = 15 {product} 325 intx MaxTrivialSize = 6 {product} 326 intx MaxVectorSize = 32 {C2 product} 327 uintx MetaspaceSize = 21810376 {pd product} 328 bool MethodFlushing = true {product} 329 uintx MinHeapDeltaBytes = 170392 {product} 330 uintx MinHeapFreeRatio = 40 {manageable} 331 intx MinInliningThreshold = 250 {product} 332 intx MinJumpTableSize = 10 {C2 pd product} 333 uintx MinMetaspaceExpansion = 340784 {product} 334 uintx MinMetaspaceFreeRatio = 40 {product} 335 uintx MinRAMFraction = 2 {product} 336 uintx MinSurvivorRatio = 3 {product} 337 uintx MinTLABSize = 2048 {product} 338 intx MonitorBound = 0 {product} 339 bool MonitorInUseLists = false {product} 340 intx MultiArrayExpandLimit = 6 {C2 product} 341 bool MustCallLoadClassInternal = false {product} 342 uintx NUMAChunkResizeWeight = 20 {product} 343 uintx NUMAInterleaveGranularity = 2097152 {product} 344 uintx NUMAPageScanRate = 256 {product} 345 uintx NUMASpaceResizeRate = 1073741824 {product} 346 bool NUMAStats = false {product} 347 ccstr NativeMemoryTracking = off {product} 348 bool NeedsDeoptSuspend = false {pd product} 349 bool NeverActAsServerClassMachine = false {pd product} 350 bool NeverTenure = false {product} 351 uintx NewRatio = 2 {product} 352 uintx NewSize = 1363144 {product} 353 uintx NewSizeThreadIncrease = 5320 {pd product} 354 intx NmethodSweepActivity = 10 {product} 355 intx NmethodSweepCheckInterval = 5 {product} 356 intx NmethodSweepFraction = 16 {product} 357 intx NodeLimitFudgeFactor = 2000 {C2 product} 358 uintx NumberOfGCLogFiles = 0 {product} 359 intx NumberOfLoopInstrToAlign = 4 {C2 product} 360 intx ObjectAlignmentInBytes = 8 {lp64_product} 361 uintx OldPLABSize = 1024 {product} 362 uintx OldPLABWeight = 50 {product} 363 uintx OldSize = 5452592 {product} 364 bool OmitStackTraceInFastThrow = true {product} 365 ccstrlist OnError = {product} 366 ccstrlist OnOutOfMemoryError = {product} 367 intx OnStackReplacePercentage = 140 {pd product} 368 bool OptimizeFill = true {C2 product} 369 bool OptimizePtrCompare = true {C2 product} 370 bool OptimizeStringConcat = true {C2 product} 371 bool OptoBundling = false {C2 pd product} 372 intx OptoLoopAlignment = 16 {pd product} 373 bool OptoScheduling = false {C2 pd product} 374 uintx PLABWeight = 75 {product} 375 bool PSChunkLargeArrays = true {product} 376 intx ParGCArrayScanChunk = 50 {product} 377 uintx ParGCDesiredObjsFromOverflowList = 20 {product} 378 bool ParGCTrimOverflow = true {product} 379 bool ParGCUseLocalOverflow = false {product} 380 uintx ParallelGCBufferWastePct = 10 {product} 381 uintx ParallelGCThreads = 0 {product} 382 bool ParallelGCVerbose = false {product} 383 uintx ParallelOldDeadWoodLimiterMean = 50 {product} 384 uintx ParallelOldDeadWoodLimiterStdDev = 80 {product} 385 bool ParallelRefProcBalancingEnabled = true {product} 386 bool ParallelRefProcEnabled = false {product} 387 bool PartialPeelAtUnsignedTests = true {C2 product} 388 bool PartialPeelLoop = true {C2 product} 389 intx PartialPeelNewPhiDelta = 0 {C2 product} 390 uintx PausePadding = 1 {product} 391 intx PerBytecodeRecompilationCutoff = 200 {product} 392 intx PerBytecodeTrapLimit = 4 {product} 393 intx PerMethodRecompilationCutoff = 400 {product} 394 intx PerMethodTrapLimit = 100 {product} 395 bool PerfAllowAtExitRegistration = false {product} 396 bool PerfBypassFileSystemCheck = false {product} 397 intx PerfDataMemorySize = 32768 {product} 398 intx PerfDataSamplingInterval = 50 {product} 399 ccstr PerfDataSaveFile = {product} 400 bool PerfDataSaveToFile = false {product} 401 bool PerfDisableSharedMem = false {product} 402 intx PerfMaxStringConstLength = 1024 {product} 403 intx PreInflateSpin = 10 {pd product} 404 bool PreferInterpreterNativeStubs = false {pd product} 405 intx PrefetchCopyIntervalInBytes = -1 {product} 406 intx PrefetchFieldsAhead = -1 {product} 407 intx PrefetchScanIntervalInBytes = -1 {product} 408 bool PreserveAllAnnotations = false {product} 409 uintx PretenureSizeThreshold = 0 {product} 410 bool PrintAdaptiveSizePolicy = false {product} 411 bool PrintCMSInitiationStatistics = false {product} 412 intx PrintCMSStatistics = 0 {product} 413 bool PrintClassHistogram = false {manageable} 414 bool PrintClassHistogramAfterFullGC = false {manageable} 415 bool PrintClassHistogramBeforeFullGC = false {manageable} 416 bool PrintCodeCache = false {product} 417 bool PrintCodeCacheOnCompilation = false {product} 418 bool PrintCommandLineFlags = false {product} 419 bool PrintCompilation = false {product} 420 bool PrintConcurrentLocks = false {manageable} 421 intx PrintFLSCensus = 0 {product} 422 intx PrintFLSStatistics = 0 {product} 423 bool PrintFlagsFinal = false {product} 424 bool PrintFlagsInitial = false {product} 425 bool PrintGC = false {manageable} 426 bool PrintGCApplicationConcurrentTime = false {product} 427 bool PrintGCApplicationStoppedTime = false {product} 428 bool PrintGCCause = true {product} 429 bool PrintGCDateStamps = false {manageable} 430 bool PrintGCDetails = false {manageable} 431 bool PrintGCID = false {manageable} 432 bool PrintGCTaskTimeStamps = false {product} 433 bool PrintGCTimeStamps = false {manageable} 434 bool PrintHeapAtGC = false {product rw} 435 bool PrintHeapAtGCExtended = false {product rw} 436 bool PrintHeapAtSIGBREAK = true {product} 437 bool PrintJNIGCStalls = false {product} 438 bool PrintJNIResolving = false {product} 439 bool PrintOldPLAB = false {product} 440 bool PrintOopAddress = false {product} 441 bool PrintPLAB = false {product} 442 bool PrintParallelOldGCPhaseTimes = false {product} 443 bool PrintPromotionFailure = false {product} 444 bool PrintReferenceGC = false {product} 445 bool PrintSafepointStatistics = false {product} 446 intx PrintSafepointStatisticsCount = 300 {product} 447 intx PrintSafepointStatisticsTimeout = -1 {product} 448 bool PrintSharedArchiveAndExit = false {product} 449 bool PrintSharedDictionary = false {product} 450 bool PrintSharedSpaces = false {product} 451 bool PrintStringDeduplicationStatistics = false {product} 452 bool PrintStringTableStatistics = false {product} 453 bool PrintTLAB = false {product} 454 bool PrintTenuringDistribution = false {product} 455 bool PrintTieredEvents = false {product} 456 bool PrintVMOptions = false {product} 457 bool PrintVMQWaitTime = false {product} 458 bool PrintWarnings = true {product} 459 uintx ProcessDistributionStride = 4 {product} 460 bool ProfileInterpreter = true {pd product} 461 bool ProfileIntervals = false {product} 462 intx ProfileIntervalsTicks = 100 {product} 463 intx ProfileMaturityPercentage = 20 {product} 464 bool ProfileVM = false {product} 465 bool ProfilerPrintByteCodeStatistics = false {product} 466 bool ProfilerRecordPC = false {product} 467 uintx PromotedPadding = 3 {product} 468 uintx QueuedAllocationWarningCount = 0 {product} 469 uintx RTMRetryCount = 5 {ARCH product} 470 bool RangeCheckElimination = true {product} 471 intx ReadPrefetchInstr = 0 {ARCH product} 472 bool ReassociateInvariants = true {C2 product} 473 bool ReduceBulkZeroing = true {C2 product} 474 bool ReduceFieldZeroing = true {C2 product} 475 bool ReduceInitialCardMarks = true {C2 product} 476 bool ReduceSignalUsage = false {product} 477 intx RefDiscoveryPolicy = 0 {product} 478 bool ReflectionWrapResolutionErrors = true {product} 479 bool RegisterFinalizersAtInit = true {product} 480 bool RelaxAccessControlCheck = false {product} 481 ccstr ReplayDataFile = {product} 482 bool RequireSharedSpaces = false {product} 483 uintx ReservedCodeCacheSize = 50331648 {pd product} 484 bool ResizeOldPLAB = true {product} 485 bool ResizePLAB = true {product} 486 bool ResizeTLAB = true {pd product} 487 bool RestoreMXCSROnJNICalls = false {product} 488 bool RestrictContended = true {product} 489 bool RewriteBytecodes = true {pd product} 490 bool RewriteFrequentPairs = true {pd product} 491 intx SafepointPollOffset = 256 {C1 pd product} 492 intx SafepointSpinBeforeYield = 2000 {product} 493 bool SafepointTimeout = false {product} 494 intx SafepointTimeoutDelay = 10000 {product} 495 bool ScavengeBeforeFullGC = true {product} 496 intx SelfDestructTimer = 0 {product} 497 uintx SharedBaseAddress = 0 {product} 498 ccstr SharedClassListFile = {product} 499 uintx SharedMiscCodeSize = 122880 {product} 500 uintx SharedMiscDataSize = 4194304 {product} 501 uintx SharedReadOnlySize = 16777216 {product} 502 uintx SharedReadWriteSize = 16777216 {product} 503 bool ShowMessageBoxOnError = false {product} 504 intx SoftRefLRUPolicyMSPerMB = 1000 {product} 505 bool SpecialEncodeISOArray = true {C2 product} 506 bool SplitIfBlocks = true {C2 product} 507 intx StackRedPages = 1 {pd product} 508 intx StackShadowPages = 6 {pd product} 509 bool StackTraceInThrowable = true {product} 510 intx StackYellowPages = 3 {pd product} 511 bool StartAttachListener = false {product} 512 intx StarvationMonitorInterval = 200 {product} 513 bool StressLdcRewrite = false {product} 514 uintx StringDeduplicationAgeThreshold = 3 {product} 515 uintx StringTableSize = 60013 {product} 516 bool SuppressFatalErrorMessage = false {product} 517 uintx SurvivorPadding = 3 {product} 518 uintx SurvivorRatio = 8 {product} 519 intx SuspendRetryCount = 50 {product} 520 intx SuspendRetryDelay = 5 {product} 521 intx SyncFlags = 0 {product} 522 ccstr SyncKnobs = {product} 523 intx SyncVerbose = 0 {product} 524 uintx TLABAllocationWeight = 35 {product} 525 uintx TLABRefillWasteFraction = 64 {product} 526 uintx TLABSize = 0 {product} 527 bool TLABStats = true {product} 528 uintx TLABWasteIncrement = 4 {product} 529 uintx TLABWasteTargetPercent = 1 {product} 530 uintx TargetPLABWastePct = 10 {product} 531 uintx TargetSurvivorRatio = 50 {product} 532 uintx TenuredGenerationSizeIncrement = 20 {product} 533 uintx TenuredGenerationSizeSupplement = 80 {product} 534 uintx TenuredGenerationSizeSupplementDecay = 2 {product} 535 intx ThreadPriorityPolicy = 0 {product} 536 bool ThreadPriorityVerbose = false {product} 537 uintx ThreadSafetyMargin = 52428800 {product} 538 intx ThreadStackSize = 0 {pd product} 539 uintx ThresholdTolerance = 10 {product} 540 intx Tier0BackedgeNotifyFreqLog = 10 {product} 541 intx Tier0InvokeNotifyFreqLog = 7 {product} 542 intx Tier0ProfilingStartPercentage = 200 {product} 543 intx Tier23InlineeNotifyFreqLog = 20 {product} 544 intx Tier2BackEdgeThreshold = 0 {product} 545 intx Tier2BackedgeNotifyFreqLog = 14 {product} 546 intx Tier2CompileThreshold = 0 {product} 547 intx Tier2InvokeNotifyFreqLog = 11 {product} 548 intx Tier3BackEdgeThreshold = 60000 {product} 549 intx Tier3BackedgeNotifyFreqLog = 13 {product} 550 intx Tier3CompileThreshold = 2000 {product} 551 intx Tier3DelayOff = 2 {product} 552 intx Tier3DelayOn = 5 {product} 553 intx Tier3InvocationThreshold = 200 {product} 554 intx Tier3InvokeNotifyFreqLog = 10 {product} 555 intx Tier3LoadFeedback = 5 {product} 556 intx Tier3MinInvocationThreshold = 100 {product} 557 intx Tier4BackEdgeThreshold = 40000 {product} 558 intx Tier4CompileThreshold = 15000 {product} 559 intx Tier4InvocationThreshold = 5000 {product} 560 intx Tier4LoadFeedback = 3 {product} 561 intx Tier4MinInvocationThreshold = 600 {product} 562 bool TieredCompilation = true {pd product} 563 intx TieredCompileTaskTimeout = 50 {product} 564 intx TieredRateUpdateMaxTime = 25 {product} 565 intx TieredRateUpdateMinTime = 1 {product} 566 intx TieredStopAtLevel = 4 {product} 567 bool TimeLinearScan = false {C1 product} 568 bool TraceBiasedLocking = false {product} 569 bool TraceClassLoading = false {product rw} 570 bool TraceClassLoadingPreorder = false {product} 571 bool TraceClassPaths = false {product} 572 bool TraceClassResolution = false {product} 573 bool TraceClassUnloading = false {product rw} 574 bool TraceDynamicGCThreads = false {product} 575 bool TraceGen0Time = false {product} 576 bool TraceGen1Time = false {product} 577 ccstr TraceJVMTI = {product} 578 bool TraceLoaderConstraints = false {product rw} 579 bool TraceMetadataHumongousAllocation = false {product} 580 bool TraceMonitorInflation = false {product} 581 bool TraceParallelOldGCTasks = false {product} 582 intx TraceRedefineClasses = 0 {product} 583 bool TraceSafepointCleanupTime = false {product} 584 bool TraceSharedLookupCache = false {product} 585 bool TraceSuspendWaitFailures = false {product} 586 intx TrackedInitializationLimit = 50 {C2 product} 587 bool TransmitErrorReport = false {product} 588 bool TrapBasedNullChecks = false {pd product} 589 bool TrapBasedRangeChecks = false {C2 pd product} 590 intx TypeProfileArgsLimit = 2 {product} 591 uintx TypeProfileLevel = 111 {pd product} 592 intx TypeProfileMajorReceiverPercent = 90 {C2 product} 593 intx TypeProfileParmsLimit = 2 {product} 594 intx TypeProfileWidth = 2 {product} 595 intx UnguardOnExecutionViolation = 0 {product} 596 bool UnlinkSymbolsALot = false {product} 597 bool Use486InstrsOnly = false {ARCH product} 598 bool UseAES = false {product} 599 bool UseAESIntrinsics = false {product} 600 intx UseAVX = 99 {ARCH product} 601 bool UseAdaptiveGCBoundary = false {product} 602 bool UseAdaptiveGenerationSizePolicyAtMajorCollection = true {product} 603 bool UseAdaptiveGenerationSizePolicyAtMinorCollection = true {product} 604 bool UseAdaptiveNUMAChunkSizing = true {product} 605 bool UseAdaptiveSizeDecayMajorGCCost = true {product} 606 bool UseAdaptiveSizePolicy = true {product} 607 bool UseAdaptiveSizePolicyFootprintGoal = true {product} 608 bool UseAdaptiveSizePolicyWithSystemGC = false {product} 609 bool UseAddressNop = false {ARCH product} 610 bool UseAltSigs = false {product} 611 bool UseAutoGCSelectPolicy = false {product} 612 bool UseBMI1Instructions = false {ARCH product} 613 bool UseBMI2Instructions = false {ARCH product} 614 bool UseBiasedLocking = true {product} 615 bool UseBimorphicInlining = true {C2 product} 616 bool UseBoundThreads = true {product} 617 bool UseCLMUL = false {ARCH product} 618 bool UseCMSBestFit = true {product} 619 bool UseCMSCollectionPassing = true {product} 620 bool UseCMSCompactAtFullCollection = true {product} 621 bool UseCMSInitiatingOccupancyOnly = false {product} 622 bool UseCRC32Intrinsics = false {product} 623 bool UseCodeCacheFlushing = true {product} 624 bool UseCompiler = true {product} 625 bool UseCompilerSafepoints = true {product} 626 bool UseCompressedClassPointers = false {lp64_product} 627 bool UseCompressedOops = false {lp64_product} 628 bool UseConcMarkSweepGC = false {product} 629 bool UseCondCardMark = false {C2 product} 630 bool UseCountLeadingZerosInstruction = false {ARCH product} 631 bool UseCountTrailingZerosInstruction = false {ARCH product} 632 bool UseCounterDecay = true {product} 633 bool UseDivMod = true {C2 product} 634 bool UseDynamicNumberOfGCThreads = false {product} 635 bool UseFPUForSpilling = false {C2 product} 636 bool UseFastAccessorMethods = true {product} 637 bool UseFastEmptyMethods = true {product} 638 bool UseFastJNIAccessors = true {product} 639 bool UseFastStosb = false {ARCH product} 640 bool UseG1GC = false {product} 641 bool UseGCLogFileRotation = false {product} 642 bool UseGCOverheadLimit = true {product} 643 bool UseGCTaskAffinity = false {product} 644 bool UseHeavyMonitors = false {product} 645 bool UseInlineCaches = true {product} 646 bool UseInterpreter = true {product} 647 bool UseJumpTables = true {C2 product} 648 bool UseLWPSynchronization = true {product} 649 bool UseLargePages = false {pd product} 650 bool UseLargePagesInMetaspace = false {product} 651 bool UseLargePagesIndividualAllocation := false {pd product} 652 bool UseLockedTracing = false {product} 653 bool UseLoopCounter = true {product} 654 bool UseLoopInvariantCodeMotion = true {C1 product} 655 bool UseLoopPredicate = true {C2 product} 656 bool UseMathExactIntrinsics = true {C2 product} 657 bool UseMaximumCompactionOnSystemGC = true {product} 658 bool UseMembar = false {pd product} 659 bool UseMultiplyToLenIntrinsic = false {C2 product} 660 bool UseNUMA = false {product} 661 bool UseNUMAInterleaving = false {product} 662 bool UseNewLongLShift = false {ARCH product} 663 bool UseOSErrorReporting = false {pd product} 664 bool UseOldInlining = true {C2 product} 665 bool UseOnStackReplacement = true {pd product} 666 bool UseOnlyInlinedBimorphic = true {C2 product} 667 bool UseOptoBiasInlining = true {C2 product} 668 bool UsePSAdaptiveSurvivorSizePolicy = true {product} 669 bool UseParNewGC = false {product} 670 bool UseParallelGC = false {product} 671 bool UseParallelOldGC = false {product} 672 bool UsePerfData = true {product} 673 bool UsePopCountInstruction = false {product} 674 bool UseRDPCForConstantTableBase = false {C2 product} 675 bool UseRTMDeopt = false {ARCH product} 676 bool UseRTMLocking = false {ARCH product} 677 bool UseSHA = false {product} 678 bool UseSHA1Intrinsics = false {product} 679 bool UseSHA256Intrinsics = false {product} 680 bool UseSHA512Intrinsics = false {product} 681 intx UseSSE = 99 {product} 682 bool UseSSE42Intrinsics = false {product} 683 bool UseSerialGC = false {product} 684 bool UseSharedSpaces = true {product} 685 bool UseSignalChaining = true {product} 686 bool UseStoreImmI16 = true {ARCH product} 687 bool UseStringDeduplication = false {product} 688 bool UseSuperWord = true {C2 product} 689 bool UseTLAB = true {pd product} 690 bool UseThreadPriorities = true {pd product} 691 bool UseTypeProfile = true {product} 692 bool UseTypeSpeculation = true {C2 product} 693 bool UseUTCFileTimestamp = true {product} 694 bool UseUnalignedLoadStores = false {ARCH product} 695 bool UseVMInterruptibleIO = false {product} 696 bool UseXMMForArrayCopy = false {product} 697 bool UseXmmI2D = false {ARCH product} 698 bool UseXmmI2F = false {ARCH product} 699 bool UseXmmLoadAndClearUpper = true {ARCH product} 700 bool UseXmmRegToRegMoveAll = false {ARCH product} 701 bool VMThreadHintNoPreempt = false {product} 702 intx VMThreadPriority = -1 {product} 703 intx VMThreadStackSize = 0 {pd product} 704 intx ValueMapInitialSize = 11 {C1 product} 705 intx ValueMapMaxLoopSize = 8 {C1 product} 706 intx ValueSearchLimit = 1000 {C2 product} 707 bool VerifyMergedCPBytecodes = true {product} 708 bool VerifySharedSpaces = false {product} 709 intx WorkAroundNPTLTimedWaitHang = 1 {product} 710 uintx YoungGenerationSizeIncrement = 20 {product} 711 uintx YoungGenerationSizeSupplement = 80 {product} 712 uintx YoungGenerationSizeSupplementDecay = 8 {product} 713 uintx YoungPLABSize = 4096 {product} 714 bool ZeroTLAB = false {product} 715 intx hashCode = 5 {product}
-XX:+PrintFlagsFinal:表示打印出XX选项在运行程序时生效的值。示例如下:
1 C:\Users\zsm>java -XX:+PrintFlagsFinal -version 2 [Global flags] 3 uintx AdaptiveSizeDecrementScaleFactor = 4 {product} 4 uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} 5 uintx AdaptiveSizePausePolicy = 0 {product} 6 uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product} 7 uintx AdaptiveSizePolicyInitializingSteps = 20 {product} 8 uintx AdaptiveSizePolicyOutputInterval = 0 {product} 9 uintx AdaptiveSizePolicyWeight = 10 {product} 10 uintx AdaptiveSizeThroughPutPolicy = 0 {product} 11 uintx AdaptiveTimeWeight = 25 {product} 12 bool AdjustConcurrency = false {product} 13 bool AggressiveOpts = false {product} 14 intx AliasLevel = 3 {C2 product} 15 bool AlignVector = true {C2 product} 16 intx AllocateInstancePrefetchLines = 1 {product} 17 intx AllocatePrefetchDistance = 256 {product} 18 intx AllocatePrefetchInstr = 0 {product} 19 intx AllocatePrefetchLines = 3 {product} 20 intx AllocatePrefetchStepSize = 64 {product} 21 intx AllocatePrefetchStyle = 1 {product} 22 bool AllowJNIEnvProxy = false {product} 23 bool AllowNonVirtualCalls = false {product} 24 bool AllowParallelDefineClass = false {product} 25 bool AllowUserSignalHandlers = false {product} 26 bool AlwaysActAsServerClassMachine = false {product} 27 bool AlwaysCompileLoopMethods = false {product} 28 bool AlwaysLockClassLoader = false {product} 29 bool AlwaysPreTouch = false {product} 30 bool AlwaysRestoreFPU = false {product} 31 bool AlwaysTenure = false {product} 32 bool AssertOnSuspendWaitFailure = false {product} 33 bool AssumeMP = false {product} 34 intx AutoBoxCacheMax = 128 {C2 product} 35 uintx AutoGCSelectPauseMillis = 5000 {product} 36 intx BCEATraceLevel = 0 {product} 37 intx BackEdgeThreshold = 100000 {pd product} 38 bool BackgroundCompilation = true {pd product} 39 uintx BaseFootPrintEstimate = 268435456 {product} 40 intx BiasedLockingBulkRebiasThreshold = 20 {product} 41 intx BiasedLockingBulkRevokeThreshold = 40 {product} 42 intx BiasedLockingDecayTime = 25000 {product} 43 intx BiasedLockingStartupDelay = 4000 {product} 44 bool BindGCTaskThreadsToCPUs = false {product} 45 bool BlockLayoutByFrequency = true {C2 product} 46 intx BlockLayoutMinDiamondPercentage = 20 {C2 product} 47 bool BlockLayoutRotateLoops = true {C2 product} 48 bool BranchOnRegister = false {C2 product} 49 bool BytecodeVerificationLocal = false {product} 50 bool BytecodeVerificationRemote = true {product} 51 bool C1OptimizeVirtualCallProfiling = true {C1 product} 52 bool C1ProfileBranches = true {C1 product} 53 bool C1ProfileCalls = true {C1 product} 54 bool C1ProfileCheckcasts = true {C1 product} 55 bool C1ProfileInlinedCalls = true {C1 product} 56 bool C1ProfileVirtualCalls = true {C1 product} 57 bool C1UpdateMethodData = true {C1 product} 58 intx CICompilerCount := 3 {product} 59 bool CICompilerCountPerCPU = true {product} 60 bool CITime = false {product} 61 bool CMSAbortSemantics = false {product} 62 uintx CMSAbortablePrecleanMinWorkPerIteration = 100 {product} 63 intx CMSAbortablePrecleanWaitMillis = 100 {manageable} 64 uintx CMSBitMapYieldQuantum = 10485760 {product} 65 uintx CMSBootstrapOccupancy = 50 {product} 66 bool CMSClassUnloadingEnabled = true {product} 67 uintx CMSClassUnloadingMaxInterval = 0 {product} 68 bool CMSCleanOnEnter = true {product} 69 bool CMSCompactWhenClearAllSoftRefs = true {product} 70 uintx CMSConcMarkMultiple = 32 {product} 71 bool CMSConcurrentMTEnabled = true {product} 72 uintx CMSCoordinatorYieldSleepCount = 10 {product} 73 bool CMSDumpAtPromotionFailure = false {product} 74 bool CMSEdenChunksRecordAlways = true {product} 75 uintx CMSExpAvgFactor = 50 {product} 76 bool CMSExtrapolateSweep = false {product} 77 uintx CMSFullGCsBeforeCompaction = 0 {product} 78 uintx CMSIncrementalDutyCycle = 10 {product} 79 uintx CMSIncrementalDutyCycleMin = 0 {product} 80 bool CMSIncrementalMode = false {product} 81 uintx CMSIncrementalOffset = 0 {product} 82 bool CMSIncrementalPacing = true {product} 83 uintx CMSIncrementalSafetyFactor = 10 {product} 84 uintx CMSIndexedFreeListReplenish = 4 {product} 85 intx CMSInitiatingOccupancyFraction = -1 {product} 86 uintx CMSIsTooFullPercentage = 98 {product} 87 double CMSLargeCoalSurplusPercent = 0.950000 {product} 88 double CMSLargeSplitSurplusPercent = 1.000000 {product} 89 bool CMSLoopWarn = false {product} 90 uintx CMSMaxAbortablePrecleanLoops = 0 {product} 91 intx CMSMaxAbortablePrecleanTime = 5000 {product} 92 uintx CMSOldPLABMax = 1024 {product} 93 uintx CMSOldPLABMin = 16 {product} 94 uintx CMSOldPLABNumRefills = 4 {product} 95 uintx CMSOldPLABReactivityFactor = 2 {product} 96 bool CMSOldPLABResizeQuicker = false {product} 97 uintx CMSOldPLABToleranceFactor = 4 {product} 98 bool CMSPLABRecordAlways = true {product} 99 uintx CMSParPromoteBlocksToClaim = 16 {product} 100 bool CMSParallelInitialMarkEnabled = true {product} 101 bool CMSParallelRemarkEnabled = true {product} 102 bool CMSParallelSurvivorRemarkEnabled = true {product} 103 uintx CMSPrecleanDenominator = 3 {product} 104 uintx CMSPrecleanIter = 3 {product} 105 uintx CMSPrecleanNumerator = 2 {product} 106 bool CMSPrecleanRefLists1 = true {product} 107 bool CMSPrecleanRefLists2 = false {product} 108 bool CMSPrecleanSurvivors1 = false {product} 109 bool CMSPrecleanSurvivors2 = true {product} 110 uintx CMSPrecleanThreshold = 1000 {product} 111 bool CMSPrecleaningEnabled = true {product} 112 bool CMSPrintChunksInDump = false {product} 113 bool CMSPrintEdenSurvivorChunks = false {product} 114 bool CMSPrintObjectsInDump = false {product} 115 uintx CMSRemarkVerifyVariant = 1 {product} 116 bool CMSReplenishIntermediate = true {product} 117 uintx CMSRescanMultiple = 32 {product} 118 uintx CMSSamplingGrain = 16384 {product} 119 bool CMSScavengeBeforeRemark = false {product} 120 uintx CMSScheduleRemarkEdenPenetration = 50 {product} 121 uintx CMSScheduleRemarkEdenSizeThreshold = 2097152 {product} 122 uintx CMSScheduleRemarkSamplingRatio = 5 {product} 123 double CMSSmallCoalSurplusPercent = 1.050000 {product} 124 double CMSSmallSplitSurplusPercent = 1.100000 {product} 125 bool CMSSplitIndexedFreeListBlocks = true {product} 126 intx CMSTriggerInterval = -1 {manageable} 127 uintx CMSTriggerRatio = 80 {product} 128 intx CMSWaitDuration = 2000 {manageable} 129 uintx CMSWorkQueueDrainThreshold = 10 {product} 130 bool CMSYield = true {product} 131 uintx CMSYieldSleepCount = 0 {product} 132 uintx CMSYoungGenPerWorker = 67108864 {pd product} 133 uintx CMS_FLSPadding = 1 {product} 134 uintx CMS_FLSWeight = 75 {product} 135 uintx CMS_SweepPadding = 1 {product} 136 uintx CMS_SweepTimerThresholdMillis = 10 {product} 137 uintx CMS_SweepWeight = 75 {product} 138 bool CheckEndorsedAndExtDirs = false {product} 139 bool CheckJNICalls = false {product} 140 bool ClassUnloading = true {product} 141 bool ClassUnloadingWithConcurrentMark = true {product} 142 intx ClearFPUAtPark = 0 {product} 143 bool ClipInlining = true {product} 144 uintx CodeCacheExpansionSize = 65536 {pd product} 145 uintx CodeCacheMinimumFreeSpace = 512000 {product} 146 bool CollectGen0First = false {product} 147 bool CompactFields = true {product} 148 intx CompilationPolicyChoice = 3 {product} 149 ccstrlist CompileCommand = {product} 150 ccstr CompileCommandFile = {product} 151 ccstrlist CompileOnly = {product} 152 intx CompileThreshold = 10000 {pd product} 153 bool CompilerThreadHintNoPreempt = true {product} 154 intx CompilerThreadPriority = -1 {product} 155 intx CompilerThreadStackSize = 0 {pd product} 156 uintx CompressedClassSpaceSize = 1073741824 {product} 157 uintx ConcGCThreads = 0 {product} 158 intx ConditionalMoveLimit = 3 {C2 pd product} 159 intx ContendedPaddingWidth = 128 {product} 160 bool ConvertSleepToYield = true {pd product} 161 bool ConvertYieldToSleep = false {product} 162 bool CreateMinidumpOnCrash = false {product} 163 bool CriticalJNINatives = true {product} 164 bool DTraceAllocProbes = false {product} 165 bool DTraceMethodProbes = false {product} 166 bool DTraceMonitorProbes = false {product} 167 bool Debugging = false {product} 168 uintx DefaultMaxRAMFraction = 4 {product} 169 intx DefaultThreadPriority = -1 {product} 170 intx DeferPollingPageLoopCount = -1 {product} 171 intx DeferThrSuspendLoopCount = 4000 {product} 172 bool DeoptimizeRandom = false {product} 173 bool DisableAttachMechanism = false {product} 174 bool DisableExplicitGC = false {product} 175 bool DisplayVMOutputToStderr = false {product} 176 bool DisplayVMOutputToStdout = false {product} 177 bool DoEscapeAnalysis = true {C2 product} 178 bool DontCompileHugeMethods = true {product} 179 bool DontYieldALot = false {pd product} 180 ccstr DumpLoadedClassList = {product} 181 bool DumpReplayDataOnError = true {product} 182 bool DumpSharedSpaces = false {product} 183 bool EagerXrunInit = false {product} 184 intx EliminateAllocationArraySizeLimit = 64 {C2 product} 185 bool EliminateAllocations = true {C2 product} 186 bool EliminateAutoBox = true {C2 product} 187 bool EliminateLocks = true {C2 product} 188 bool EliminateNestedLocks = true {C2 product} 189 intx EmitSync = 0 {product} 190 bool EnableContended = true {product} 191 bool EnableSharedLookupCache = true {product} 192 bool EnableTracing = false {product} 193 uintx ErgoHeapSizeLimit = 0 {product} 194 ccstr ErrorFile = {product} 195 ccstr ErrorReportServer = {product} 196 double EscapeAnalysisTimeout = 20.000000 {C2 product} 197 bool EstimateArgEscape = true {product} 198 bool ExplicitGCInvokesConcurrent = false {product} 199 bool ExplicitGCInvokesConcurrentAndUnloadsClasses = false {product} 200 bool ExtendedDTraceProbes = false {product} 201 ccstr ExtraSharedClassListFile = {product} 202 bool FLSAlwaysCoalesceLarge = false {product} 203 uintx FLSCoalescePolicy = 2 {product} 204 double FLSLargestBlockCoalesceProximity = 0.990000 {product} 205 bool FailOverToOldVerifier = true {product} 206 bool FastTLABRefill = true {product} 207 intx FenceInstruction = 0 {ARCH product} 208 intx FieldsAllocationStyle = 1 {product} 209 bool FilterSpuriousWakeups = true {product} 210 ccstr FlightRecorderOptions = {product} 211 bool ForceNUMA = false {product} 212 bool ForceTimeHighResolution = false {product} 213 intx FreqInlineSize = 325 {pd product} 214 double G1ConcMarkStepDurationMillis = 10.000000 {product} 215 uintx G1ConcRSHotCardLimit = 4 {product} 216 uintx G1ConcRSLogCacheSize = 10 {product} 217 intx G1ConcRefinementGreenZone = 0 {product} 218 intx G1ConcRefinementRedZone = 0 {product} 219 intx G1ConcRefinementServiceIntervalMillis = 300 {product} 220 uintx G1ConcRefinementThreads = 0 {product} 221 intx G1ConcRefinementThresholdStep = 0 {product} 222 intx G1ConcRefinementYellowZone = 0 {product} 223 uintx G1ConfidencePercent = 50 {product} 224 uintx G1HeapRegionSize = 0 {product} 225 uintx G1HeapWastePercent = 5 {product} 226 uintx G1MixedGCCountTarget = 8 {product} 227 intx G1RSetRegionEntries = 0 {product} 228 uintx G1RSetScanBlockSize = 64 {product} 229 intx G1RSetSparseRegionEntries = 0 {product} 230 intx G1RSetUpdatingPauseTimePercent = 10 {product} 231 intx G1RefProcDrainInterval = 10 {product} 232 uintx G1ReservePercent = 10 {product} 233 uintx G1SATBBufferEnqueueingThresholdPercent = 60 {product} 234 intx G1SATBBufferSize = 1024 {product} 235 intx G1UpdateBufferSize = 256 {product} 236 bool G1UseAdaptiveConcRefinement = true {product} 237 uintx GCDrainStackTargetSize = 64 {product} 238 uintx GCHeapFreeLimit = 2 {product} 239 uintx GCLockerEdenExpansionPercent = 5 {product} 240 bool GCLockerInvokesConcurrent = false {product} 241 uintx GCLogFileSize = 8192 {product} 242 uintx GCPauseIntervalMillis = 0 {product} 243 uintx GCTaskTimeStampEntries = 200 {product} 244 uintx GCTimeLimit = 98 {product} 245 uintx GCTimeRatio = 99 {product} 246 uintx HeapBaseMinAddress = 2147483648 {pd product} 247 bool HeapDumpAfterFullGC = false {manageable} 248 bool HeapDumpBeforeFullGC = false {manageable} 249 bool HeapDumpOnOutOfMemoryError = false {manageable} 250 ccstr HeapDumpPath = {manageable} 251 uintx HeapFirstMaximumCompactionCount = 3 {product} 252 uintx HeapMaximumCompactionInterval = 20 {product} 253 uintx HeapSizePerGCThread = 87241520 {product} 254 bool IgnoreEmptyClassPaths = false {product} 255 bool IgnoreUnrecognizedVMOptions = false {product} 256 uintx IncreaseFirstTierCompileThresholdAt = 50 {product} 257 bool IncrementalInline = true {C2 product} 258 uintx InitialBootClassLoaderMetaspaceSize = 4194304 {product} 259 uintx InitialCodeCacheSize = 2555904 {pd product} 260 uintx InitialHeapSize := 134217728 {product} 261 uintx InitialRAMFraction = 64 {product} 262 uintx InitialSurvivorRatio = 8 {product} 263 uintx InitialTenuringThreshold = 7 {product} 264 uintx InitiatingHeapOccupancyPercent = 45 {product} 265 bool Inline = true {product} 266 ccstr InlineDataFile = {product} 267 intx InlineSmallCode = 2000 {pd product} 268 bool InlineSynchronizedMethods = true {C1 product} 269 bool InsertMemBarAfterArraycopy = true {C2 product} 270 intx InteriorEntryAlignment = 16 {C2 pd product} 271 intx InterpreterProfilePercentage = 33 {product} 272 bool JNIDetachReleasesMonitors = true {product} 273 bool JavaMonitorsInStackTrace = true {product} 274 intx JavaPriority10_To_OSPriority = -1 {product} 275 intx JavaPriority1_To_OSPriority = -1 {product} 276 intx JavaPriority2_To_OSPriority = -1 {product} 277 intx JavaPriority3_To_OSPriority = -1 {product} 278 intx JavaPriority4_To_OSPriority = -1 {product} 279 intx JavaPriority5_To_OSPriority = -1 {product} 280 intx JavaPriority6_To_OSPriority = -1 {product} 281 intx JavaPriority7_To_OSPriority = -1 {product} 282 intx JavaPriority8_To_OSPriority = -1 {product} 283 intx JavaPriority9_To_OSPriority = -1 {product} 284 bool LIRFillDelaySlots = false {C1 pd product} 285 uintx LargePageHeapSizeThreshold = 134217728 {product} 286 uintx LargePageSizeInBytes = 0 {product} 287 bool LazyBootClassLoader = true {product} 288 intx LiveNodeCountInliningCutoff = 40000 {C2 product} 289 bool LogCommercialFeatures = false {product} 290 intx LoopMaxUnroll = 16 {C2 product} 291 intx LoopOptsCount = 43 {C2 product} 292 intx LoopUnrollLimit = 60 {C2 pd product} 293 intx LoopUnrollMin = 4 {C2 product} 294 bool LoopUnswitching = true {C2 product} 295 bool ManagementServer = false {product} 296 uintx MarkStackSize = 4194304 {product} 297 uintx MarkStackSizeMax = 536870912 {product} 298 uintx MarkSweepAlwaysCompactCount = 4 {product} 299 uintx MarkSweepDeadRatio = 1 {product} 300 intx MaxBCEAEstimateLevel = 5 {product} 301 intx MaxBCEAEstimateSize = 150 {product} 302 uintx MaxDirectMemorySize = 0 {product} 303 bool MaxFDLimit = true {product} 304 uintx MaxGCMinorPauseMillis = 4294967295 {product} 305 uintx MaxGCPauseMillis = 4294967295 {product} 306 uintx MaxHeapFreeRatio = 100 {manageable} 307 uintx MaxHeapSize := 2124414976 {product} 308 intx MaxInlineLevel = 9 {product} 309 intx MaxInlineSize = 35 {product} 310 intx MaxJNILocalCapacity = 65536 {product} 311 intx MaxJavaStackTraceDepth = 1024 {product} 312 intx MaxJumpTableSize = 65000 {C2 product} 313 intx MaxJumpTableSparseness = 5 {C2 product} 314 intx MaxLabelRootDepth = 1100 {C2 product} 315 intx MaxLoopPad = 11 {C2 product} 316 uintx MaxMetaspaceExpansion = 5451776 {product} 317 uintx MaxMetaspaceFreeRatio = 70 {product} 318 uintx MaxMetaspaceSize = 4294901760 {product} 319 uintx MaxNewSize := 707788800 {product} 320 intx MaxNodeLimit = 75000 {C2 product} 321 uint64_t MaxRAM = 0 {pd product} 322 uintx MaxRAMFraction = 4 {product} 323 intx MaxRecursiveInlineLevel = 1 {product} 324 uintx MaxTenuringThreshold = 15 {product} 325 intx MaxTrivialSize = 6 {product} 326 intx MaxVectorSize = 32 {C2 product} 327 uintx MetaspaceSize = 21807104 {pd product} 328 bool MethodFlushing = true {product} 329 uintx MinHeapDeltaBytes := 524288 {product} 330 uintx MinHeapFreeRatio = 0 {manageable} 331 intx MinInliningThreshold = 250 {product} 332 intx MinJumpTableSize = 10 {C2 pd product} 333 uintx MinMetaspaceExpansion = 339968 {product} 334 uintx MinMetaspaceFreeRatio = 40 {product} 335 uintx MinRAMFraction = 2 {product} 336 uintx MinSurvivorRatio = 3 {product} 337 uintx MinTLABSize = 2048 {product} 338 intx MonitorBound = 0 {product} 339 bool MonitorInUseLists = false {product} 340 intx MultiArrayExpandLimit = 6 {C2 product} 341 bool MustCallLoadClassInternal = false {product} 342 uintx NUMAChunkResizeWeight = 20 {product} 343 uintx NUMAInterleaveGranularity = 2097152 {product} 344 uintx NUMAPageScanRate = 256 {product} 345 uintx NUMASpaceResizeRate = 1073741824 {product} 346 bool NUMAStats = false {product} 347 ccstr NativeMemoryTracking = off {product} 348 bool NeedsDeoptSuspend = false {pd product} 349 bool NeverActAsServerClassMachine = false {pd product} 350 bool NeverTenure = false {product} 351 uintx NewRatio = 2 {product} 352 uintx NewSize := 44564480 {product} 353 uintx NewSizeThreadIncrease = 5320 {pd product} 354 intx NmethodSweepActivity = 10 {product} 355 intx NmethodSweepCheckInterval = 5 {product} 356 intx NmethodSweepFraction = 16 {product} 357 intx NodeLimitFudgeFactor = 2000 {C2 product} 358 uintx NumberOfGCLogFiles = 0 {product} 359 intx NumberOfLoopInstrToAlign = 4 {C2 product} 360 intx ObjectAlignmentInBytes = 8 {lp64_product} 361 uintx OldPLABSize = 1024 {product} 362 uintx OldPLABWeight = 50 {product} 363 uintx OldSize := 89653248 {product} 364 bool OmitStackTraceInFastThrow = true {product} 365 ccstrlist OnError = {product} 366 ccstrlist OnOutOfMemoryError = {product} 367 intx OnStackReplacePercentage = 140 {pd product} 368 bool OptimizeFill = true {C2 product} 369 bool OptimizePtrCompare = true {C2 product} 370 bool OptimizeStringConcat = true {C2 product} 371 bool OptoBundling = false {C2 pd product} 372 intx OptoLoopAlignment = 16 {pd product} 373 bool OptoScheduling = false {C2 pd product} 374 uintx PLABWeight = 75 {product} 375 bool PSChunkLargeArrays = true {product} 376 intx ParGCArrayScanChunk = 50 {product} 377 uintx ParGCDesiredObjsFromOverflowList = 20 {product} 378 bool ParGCTrimOverflow = true {product} 379 bool ParGCUseLocalOverflow = false {product} 380 uintx ParallelGCBufferWastePct = 10 {product} 381 uintx ParallelGCThreads = 4 {product} 382 bool ParallelGCVerbose = false {product} 383 uintx ParallelOldDeadWoodLimiterMean = 50 {product} 384 uintx ParallelOldDeadWoodLimiterStdDev = 80 {product} 385 bool ParallelRefProcBalancingEnabled = true {product} 386 bool ParallelRefProcEnabled = false {product} 387 bool PartialPeelAtUnsignedTests = true {C2 product} 388 bool PartialPeelLoop = true {C2 product} 389 intx PartialPeelNewPhiDelta = 0 {C2 product} 390 uintx PausePadding = 1 {product} 391 intx PerBytecodeRecompilationCutoff = 200 {product} 392 intx PerBytecodeTrapLimit = 4 {product} 393 intx PerMethodRecompilationCutoff = 400 {product} 394 intx PerMethodTrapLimit = 100 {product} 395 bool PerfAllowAtExitRegistration = false {product} 396 bool PerfBypassFileSystemCheck = false {product} 397 intx PerfDataMemorySize = 32768 {product} 398 intx PerfDataSamplingInterval = 50 {product} 399 ccstr PerfDataSaveFile = {product} 400 bool PerfDataSaveToFile = false {product} 401 bool PerfDisableSharedMem = false {product} 402 intx PerfMaxStringConstLength = 1024 {product} 403 intx PreInflateSpin = 10 {pd product} 404 bool PreferInterpreterNativeStubs = false {pd product} 405 intx PrefetchCopyIntervalInBytes = 576 {product} 406 intx PrefetchFieldsAhead = 1 {product} 407 intx PrefetchScanIntervalInBytes = 576 {product} 408 bool PreserveAllAnnotations = false {product} 409 uintx PretenureSizeThreshold = 0 {product} 410 bool PrintAdaptiveSizePolicy = false {product} 411 bool PrintCMSInitiationStatistics = false {product} 412 intx PrintCMSStatistics = 0 {product} 413 bool PrintClassHistogram = false {manageable} 414 bool PrintClassHistogramAfterFullGC = false {manageable} 415 bool PrintClassHistogramBeforeFullGC = false {manageable} 416 bool PrintCodeCache = false {product} 417 bool PrintCodeCacheOnCompilation = false {product} 418 bool PrintCommandLineFlags = false {product} 419 bool PrintCompilation = false {product} 420 bool PrintConcurrentLocks = false {manageable} 421 intx PrintFLSCensus = 0 {product} 422 intx PrintFLSStatistics = 0 {product} 423 bool PrintFlagsFinal := true {product} 424 bool PrintFlagsInitial = false {product} 425 bool PrintGC = false {manageable} 426 bool PrintGCApplicationConcurrentTime = false {product} 427 bool PrintGCApplicationStoppedTime = false {product} 428 bool PrintGCCause = true {product} 429 bool PrintGCDateStamps = false {manageable} 430 bool PrintGCDetails = false {manageable} 431 bool PrintGCID = false {manageable} 432 bool PrintGCTaskTimeStamps = false {product} 433 bool PrintGCTimeStamps = false {manageable} 434 bool PrintHeapAtGC = false {product rw} 435 bool PrintHeapAtGCExtended = false {product rw} 436 bool PrintHeapAtSIGBREAK = true {product} 437 bool PrintJNIGCStalls = false {product} 438 bool PrintJNIResolving = false {product} 439 bool PrintOldPLAB = false {product} 440 bool PrintOopAddress = false {product} 441 bool PrintPLAB = false {product} 442 bool PrintParallelOldGCPhaseTimes = false {product} 443 bool PrintPromotionFailure = false {product} 444 bool PrintReferenceGC = false {product} 445 bool PrintSafepointStatistics = false {product} 446 intx PrintSafepointStatisticsCount = 300 {product} 447 intx PrintSafepointStatisticsTimeout = -1 {product} 448 bool PrintSharedArchiveAndExit = false {product} 449 bool PrintSharedDictionary = false {product} 450 bool PrintSharedSpaces = false {product} 451 bool PrintStringDeduplicationStatistics = false {product} 452 bool PrintStringTableStatistics = false {product} 453 bool PrintTLAB = false {product} 454 bool PrintTenuringDistribution = false {product} 455 bool PrintTieredEvents = false {product} 456 bool PrintVMOptions = false {product} 457 bool PrintVMQWaitTime = false {product} 458 bool PrintWarnings = true {product} 459 uintx ProcessDistributionStride = 4 {product} 460 bool ProfileInterpreter = true {pd product} 461 bool ProfileIntervals = false {product} 462 intx ProfileIntervalsTicks = 100 {product} 463 intx ProfileMaturityPercentage = 20 {product} 464 bool ProfileVM = false {product} 465 bool ProfilerPrintByteCodeStatistics = false {product} 466 bool ProfilerRecordPC = false {product} 467 uintx PromotedPadding = 3 {product} 468 uintx QueuedAllocationWarningCount = 0 {product} 469 uintx RTMRetryCount = 5 {ARCH product} 470 bool RangeCheckElimination = true {product} 471 intx ReadPrefetchInstr = 0 {ARCH product} 472 bool ReassociateInvariants = true {C2 product} 473 bool ReduceBulkZeroing = true {C2 product} 474 bool ReduceFieldZeroing = true {C2 product} 475 bool ReduceInitialCardMarks = true {C2 product} 476 bool ReduceSignalUsage = false {product} 477 intx RefDiscoveryPolicy = 0 {product} 478 bool ReflectionWrapResolutionErrors = true {product} 479 bool RegisterFinalizersAtInit = true {product} 480 bool RelaxAccessControlCheck = false {product} 481 ccstr ReplayDataFile = {product} 482 bool RequireSharedSpaces = false {product} 483 uintx ReservedCodeCacheSize = 251658240 {pd product} 484 bool ResizeOldPLAB = true {product} 485 bool ResizePLAB = true {product} 486 bool ResizeTLAB = true {pd product} 487 bool RestoreMXCSROnJNICalls = false {product} 488 bool RestrictContended = true {product} 489 bool RewriteBytecodes = true {pd product} 490 bool RewriteFrequentPairs = true {pd product} 491 intx SafepointPollOffset = 256 {C1 pd product} 492 intx SafepointSpinBeforeYield = 2000 {product} 493 bool SafepointTimeout = false {product} 494 intx SafepointTimeoutDelay = 10000 {product} 495 bool ScavengeBeforeFullGC = true {product} 496 intx SelfDestructTimer = 0 {product} 497 uintx SharedBaseAddress = 0 {product} 498 ccstr SharedClassListFile = {product} 499 uintx SharedMiscCodeSize = 122880 {product} 500 uintx SharedMiscDataSize = 4194304 {product} 501 uintx SharedReadOnlySize = 16777216 {product} 502 uintx SharedReadWriteSize = 16777216 {product} 503 bool ShowMessageBoxOnError = false {product} 504 intx SoftRefLRUPolicyMSPerMB = 1000 {product} 505 bool SpecialEncodeISOArray = true {C2 product} 506 bool SplitIfBlocks = true {C2 product} 507 intx StackRedPages = 1 {pd product} 508 intx StackShadowPages = 6 {pd product} 509 bool StackTraceInThrowable = true {product} 510 intx StackYellowPages = 3 {pd product} 511 bool StartAttachListener = false {product} 512 intx StarvationMonitorInterval = 200 {product} 513 bool StressLdcRewrite = false {product} 514 uintx StringDeduplicationAgeThreshold = 3 {product} 515 uintx StringTableSize = 60013 {product} 516 bool SuppressFatalErrorMessage = false {product} 517 uintx SurvivorPadding = 3 {product} 518 uintx SurvivorRatio = 8 {product} 519 intx SuspendRetryCount = 50 {product} 520 intx SuspendRetryDelay = 5 {product} 521 intx SyncFlags = 0 {product} 522 ccstr SyncKnobs = {product} 523 intx SyncVerbose = 0 {product} 524 uintx TLABAllocationWeight = 35 {product} 525 uintx TLABRefillWasteFraction = 64 {product} 526 uintx TLABSize = 0 {product} 527 bool TLABStats = true {product} 528 uintx TLABWasteIncrement = 4 {product} 529 uintx TLABWasteTargetPercent = 1 {product} 530 uintx TargetPLABWastePct = 10 {product} 531 uintx TargetSurvivorRatio = 50 {product} 532 uintx TenuredGenerationSizeIncrement = 20 {product} 533 uintx TenuredGenerationSizeSupplement = 80 {product} 534 uintx TenuredGenerationSizeSupplementDecay = 2 {product} 535 intx ThreadPriorityPolicy = 0 {product} 536 bool ThreadPriorityVerbose = false {product} 537 uintx ThreadSafetyMargin = 52428800 {product} 538 intx ThreadStackSize = 0 {pd product} 539 uintx ThresholdTolerance = 10 {product} 540 intx Tier0BackedgeNotifyFreqLog = 10 {product} 541 intx Tier0InvokeNotifyFreqLog = 7 {product} 542 intx Tier0ProfilingStartPercentage = 200 {product} 543 intx Tier23InlineeNotifyFreqLog = 20 {product} 544 intx Tier2BackEdgeThreshold = 0 {product} 545 intx Tier2BackedgeNotifyFreqLog = 14 {product} 546 intx Tier2CompileThreshold = 0 {product} 547 intx Tier2InvokeNotifyFreqLog = 11 {product} 548 intx Tier3BackEdgeThreshold = 60000 {product} 549 intx Tier3BackedgeNotifyFreqLog = 13 {product} 550 intx Tier3CompileThreshold = 2000 {product} 551 intx Tier3DelayOff = 2 {product} 552 intx Tier3DelayOn = 5 {product} 553 intx Tier3InvocationThreshold = 200 {product} 554 intx Tier3InvokeNotifyFreqLog = 10 {product} 555 intx Tier3LoadFeedback = 5 {product} 556 intx Tier3MinInvocationThreshold = 100 {product} 557 intx Tier4BackEdgeThreshold = 40000 {product} 558 intx Tier4CompileThreshold = 15000 {product} 559 intx Tier4InvocationThreshold = 5000 {product} 560 intx Tier4LoadFeedback = 3 {product} 561 intx Tier4MinInvocationThreshold = 600 {product} 562 bool TieredCompilation = true {pd product} 563 intx TieredCompileTaskTimeout = 50 {product} 564 intx TieredRateUpdateMaxTime = 25 {product} 565 intx TieredRateUpdateMinTime = 1 {product} 566 intx TieredStopAtLevel = 4 {product} 567 bool TimeLinearScan = false {C1 product} 568 bool TraceBiasedLocking = false {product} 569 bool TraceClassLoading = false {product rw} 570 bool TraceClassLoadingPreorder = false {product} 571 bool TraceClassPaths = false {product} 572 bool TraceClassResolution = false {product} 573 bool TraceClassUnloading = false {product rw} 574 bool TraceDynamicGCThreads = false {product} 575 bool TraceGen0Time = false {product} 576 bool TraceGen1Time = false {product} 577 ccstr TraceJVMTI = {product} 578 bool TraceLoaderConstraints = false {product rw} 579 bool TraceMetadataHumongousAllocation = false {product} 580 bool TraceMonitorInflation = false {product} 581 bool TraceParallelOldGCTasks = false {product} 582 intx TraceRedefineClasses = 0 {product} 583 bool TraceSafepointCleanupTime = false {product} 584 bool TraceSharedLookupCache = false {product} 585 bool TraceSuspendWaitFailures = false {product} 586 intx TrackedInitializationLimit = 50 {C2 product} 587 bool TransmitErrorReport = false {product} 588 bool TrapBasedNullChecks = false {pd product} 589 bool TrapBasedRangeChecks = false {C2 pd product} 590 intx TypeProfileArgsLimit = 2 {product} 591 uintx TypeProfileLevel = 111 {pd product} 592 intx TypeProfileMajorReceiverPercent = 90 {C2 product} 593 intx TypeProfileParmsLimit = 2 {product} 594 intx TypeProfileWidth = 2 {product} 595 intx UnguardOnExecutionViolation = 0 {product} 596 bool UnlinkSymbolsALot = false {product} 597 bool Use486InstrsOnly = false {ARCH product} 598 bool UseAES = true {product} 599 bool UseAESIntrinsics = true {product} 600 intx UseAVX = 2 {ARCH product} 601 bool UseAdaptiveGCBoundary = false {product} 602 bool UseAdaptiveGenerationSizePolicyAtMajorCollection = true {product} 603 bool UseAdaptiveGenerationSizePolicyAtMinorCollection = true {product} 604 bool UseAdaptiveNUMAChunkSizing = true {product} 605 bool UseAdaptiveSizeDecayMajorGCCost = true {product} 606 bool UseAdaptiveSizePolicy = true {product} 607 bool UseAdaptiveSizePolicyFootprintGoal = true {product} 608 bool UseAdaptiveSizePolicyWithSystemGC = false {product} 609 bool UseAddressNop = true {ARCH product} 610 bool UseAltSigs = false {product} 611 bool UseAutoGCSelectPolicy = false {product} 612 bool UseBMI1Instructions = true {ARCH product} 613 bool UseBMI2Instructions = true {ARCH product} 614 bool UseBiasedLocking = true {product} 615 bool UseBimorphicInlining = true {C2 product} 616 bool UseBoundThreads = true {product} 617 bool UseCLMUL = true {ARCH product} 618 bool UseCMSBestFit = true {product} 619 bool UseCMSCollectionPassing = true {product} 620 bool UseCMSCompactAtFullCollection = true {product} 621 bool UseCMSInitiatingOccupancyOnly = false {product} 622 bool UseCRC32Intrinsics = true {product} 623 bool UseCodeCacheFlushing = true {product} 624 bool UseCompiler = true {product} 625 bool UseCompilerSafepoints = true {product} 626 bool UseCompressedClassPointers := true {lp64_product} 627 bool UseCompressedOops := true {lp64_product} 628 bool UseConcMarkSweepGC = false {product} 629 bool UseCondCardMark = false {C2 product} 630 bool UseCountLeadingZerosInstruction = true {ARCH product} 631 bool UseCountTrailingZerosInstruction = true {ARCH product} 632 bool UseCounterDecay = true {product} 633 bool UseDivMod = true {C2 product} 634 bool UseDynamicNumberOfGCThreads = false {product} 635 bool UseFPUForSpilling = true {C2 product} 636 bool UseFastAccessorMethods = false {product} 637 bool UseFastEmptyMethods = false {product} 638 bool UseFastJNIAccessors = true {product} 639 bool UseFastStosb = true {ARCH product} 640 bool UseG1GC = false {product} 641 bool UseGCLogFileRotation = false {product} 642 bool UseGCOverheadLimit = true {product} 643 bool UseGCTaskAffinity = false {product} 644 bool UseHeavyMonitors = false {product} 645 bool UseInlineCaches = true {product} 646 bool UseInterpreter = true {product} 647 bool UseJumpTables = true {C2 product} 648 bool UseLWPSynchronization = true {product} 649 bool UseLargePages = false {pd product} 650 bool UseLargePagesInMetaspace = false {product} 651 bool UseLargePagesIndividualAllocation := false {pd product} 652 bool UseLockedTracing = false {product} 653 bool UseLoopCounter = true {product} 654 bool UseLoopInvariantCodeMotion = true {C1 product} 655 bool UseLoopPredicate = true {C2 product} 656 bool UseMathExactIntrinsics = true {C2 product} 657 bool UseMaximumCompactionOnSystemGC = true {product} 658 bool UseMembar = false {pd product} 659 bool UseMultiplyToLenIntrinsic = true {C2 product} 660 bool UseNUMA = false {product} 661 bool UseNUMAInterleaving = false {product} 662 bool UseNewLongLShift = false {ARCH product} 663 bool UseOSErrorReporting = false {pd product} 664 bool UseOldInlining = true {C2 product} 665 bool UseOnStackReplacement = true {pd product} 666 bool UseOnlyInlinedBimorphic = true {C2 product} 667 bool UseOptoBiasInlining = true {C2 product} 668 bool UsePSAdaptiveSurvivorSizePolicy = true {product} 669 bool UseParNewGC = false {product} 670 bool UseParallelGC := true {product} 671 bool UseParallelOldGC = true {product} 672 bool UsePerfData = true {product} 673 bool UsePopCountInstruction = true {product} 674 bool UseRDPCForConstantTableBase = false {C2 product} 675 bool UseRTMDeopt = false {ARCH product} 676 bool UseRTMLocking = false {ARCH product} 677 bool UseSHA = false {product} 678 bool UseSHA1Intrinsics = false {product} 679 bool UseSHA256Intrinsics = false {product} 680 bool UseSHA512Intrinsics = false {product} 681 intx UseSSE = 4 {product} 682 bool UseSSE42Intrinsics = true {product} 683 bool UseSerialGC = false {product} 684 bool UseSharedSpaces = false {product} 685 bool UseSignalChaining = true {product} 686 bool UseStoreImmI16 = false {ARCH product} 687 bool UseStringDeduplication = false {product} 688 bool UseSuperWord = true {C2 product} 689 bool UseTLAB = true {pd product} 690 bool UseThreadPriorities = true {pd product} 691 bool UseTypeProfile = true {product} 692 bool UseTypeSpeculation = true {C2 product} 693 bool UseUTCFileTimestamp = true {product} 694 bool UseUnalignedLoadStores = false {ARCH product} 695 bool UseVMInterruptibleIO = false {product} 696 bool UseXMMForArrayCopy = true {product} 697 bool UseXmmI2D = false {ARCH product} 698 bool UseXmmI2F = false {ARCH product} 699 bool UseXmmLoadAndClearUpper = true {ARCH product} 700 bool UseXmmRegToRegMoveAll = true {ARCH product} 701 bool VMThreadHintNoPreempt = false {product} 702 intx VMThreadPriority = -1 {product} 703 intx VMThreadStackSize = 0 {pd product} 704 intx ValueMapInitialSize = 11 {C1 product} 705 intx ValueMapMaxLoopSize = 8 {C1 product} 706 intx ValueSearchLimit = 1000 {C2 product} 707 bool VerifyMergedCPBytecodes = true {product} 708 bool VerifySharedSpaces = false {product} 709 intx WorkAroundNPTLTimedWaitHang = 1 {product} 710 uintx YoungGenerationSizeIncrement = 20 {product} 711 uintx YoungGenerationSizeSupplement = 80 {product} 712 uintx YoungGenerationSizeSupplementDecay = 8 {product} 713 uintx YoungPLABSize = 4096 {product} 714 bool ZeroTLAB = false {product} 715 intx hashCode = 5 {product} 716 java version "1.8.0_45" 717 Java(TM) SE Runtime Environment (build 1.8.0_45-b14) 718 Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
2.5、各区域内存大小设置
注:虚拟机启动时就会把参数中设定大小的内存全部划为私有,即使扩容前有一部分内存不会被用户代码用到,这部分内存也不会交给其他进程使用。
2.5.1、方法区
永久代(Java8之前,Java8中没有永久代概念,下面参数无效)
-XX:PermSize=256m:设置永久代初始值为256M。
-XX:MaxPermSize=256m:设置永久代最大值为256M。(同上)
元空间(Java8中)
-XX:MetaspaceSize,初始空间大小,达到该值就会触发垃圾收集器进行类型卸载,同时GC会对该值进行调整:如果释放了大量的空间,就适当降低该值;如果释放了很少的空间,那么在不超过MaxMetaspaceSize时,适当提高该值
-XX:MaxMetaspaceSize,最大空间,默认没有限制。
2.5.2、栈
-Xss128k:设置每个线程的栈大小。JDK5.0以后每个线程栈大小为1M,之前每个线程栈大小为256K。应当根据应用的线程所需内存大小进行调整。在相同物理内存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。需要注意的是:当这个值被设置的较大(例如>2MB)时将会在很大程度上降低系统的性能。
2.5.3、堆
-Xmx3550m:等价于-XX:MaxHeapSize,设置JVM最大堆内存为3550M。
-Xms3550m:等价于-XX:InitialHeapSize,设置JVM初始堆内存为3550M。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。
-Xmn2g:设置年轻代大小为2G。在整个堆内存大小确定的情况下,增大年轻代将会减小年老代,反之亦然。此值关系到JVM垃圾回收,对系统性能影响较大,官方推荐配置为整个堆大小的3/8。
-XX:NewSize=1024m:设置年轻代初始值为1024M。
-XX:MaxNewSize=1024m:设置年轻代最大值为1024M。
-XX:SurvivorRatio=4:设置年轻代中Eden区与一个Survivor区的比值。表示Edgen为一个Survivor的4倍,即1个Survivor区占整个年轻代大小的1/6。
-XX:NewRatio=4:设置老年代与年轻代(包括1个Eden和2个Survivor区)的比值。表示老年代是年轻代的4倍。
-XX:PretenureSizeThreadshold=1024:设置让大于此阈值的对象直接分配在老年代(只对Serial、ParNew收集器有效),单位为字节
-XX:MaxTenuringThreshold=7:
表示一个对象如果在Survivor区移动了7次那下次MinorGC时就进入老年代。如果设置为0的话,则年轻代对象不经过Survivor区,直接进入年老代,对于需要大量常驻内存的应用,这样做可以提高效率。如果将此值设置为一个较大值,则年轻代对象会在Survivor区进行多次复制,这样可以增加对象在年轻代存活时间,增加对象在年轻代被垃圾回收的概率,减少Full GC的频率,可以在某种程度上提高服务稳定性。
-XX:+PrintTenuringDistribution:让JVM在每次MinorGC后打印出当前使用的Survivor中对象的年龄分布。示例:
Desired survivor size 75497472 bytes, new threshold 15 (max 15) - age 1: 19321624 bytes, 19321624 total - age 2: 79376 bytes, 19401000 total - age 3: 2904256 bytes, 22305256 total
第一行显示Survivor容量及对象被移到老年代的年龄阈值。
第二行起,每行显示当前Survivor中某个年龄下对象的大小及小于等于该年龄的对象大小总和。因为目前Survivor空间中对象的大小22M小于期望Survivor空间的大小72M,所以没有对象会被移到老年代。
假设下一次MinorGC后的输出结果为:
Desired survivor size 75497472 bytes, new threshold 2 (max 15) - age 1: 68407384 bytes, 68407384 total - age 2: 12494576 bytes, 80901960 total - age 3: 79376 bytes, 80981336 total - age 4: 2904256 bytes, 83885592 total
上次MinorGC后还存活的对象在这次MinorGC年龄都增加了1,可以看到上次年龄为2和3的对象(对应在这次GC后的年龄为3和4)依然存在(大小未变),而一部分上次对象年龄为1的对象在这次GC时被回收了。同时可以看到这次新增了约68M的新对象。这次MinorGC后Survivor区域中对象总的大小为约83M,大于了期望的Survivor空间的大小72M,因此它就把对象移到老年代的年龄的阈值调整为2,在下次MinorGC时一部分对象就会被移到老年代了。
相关的调整选项有:
- -XX:InitialTenuringThreshold 表示对象被移到老年代的年龄阈值的初始值
- -XX:MaxTenuringThreshold 表示对象被移到老年代的年龄阈值的最大值
- -XX:TargetSurvivorRatio 表示MinorGC结束了Survivor区域中占用空间的期望比例。
这些参数的调节没有统一的标准,但是有两点可以借鉴:
1、如果Survivor中对象的年龄分布显示很多对象在经历了多次GC最终年龄达到了-XX:MaxTenuringThreshold才被移到老年代,这可能说明-XX:MaxTenuringThreshold设置得过大,也有可能是Survivor的空间过大。
2、如果-XX:MaxTenuringThreshold的值大于1,但是很多对象年龄都不大于1,那就得关注一下期望的Survivor空间。如果每次GC后Survivor中对象的大小都没有超过期望的Survivor空间大小,则说明GC工作得很好。反之,则说明可能Survivor空间小了,使得新生成的对象很快就被移到了老年代了。
2.5.4、直接内存
-XX:MaxDirectMemorySize:指定DirectMemory容量,若未指定,则默认与Java堆最大值一样。
每个进程能使用的内存大小受操作系统的限制,在堆等的内存大小不变时,配置的栈内存越小,能开启的线程数越多。
2.6、OutofMemory相关的选项
如果程序发生了OOM后,JVM可以配置一些选项来做些善后工作,比如把内存给dump下来以分析原因,或者自动采取一些别的动作。
- -XX:+HeapDumpOnOutOfMemoryError 表示在内存出现OOM的时候,把Heap转存(Dump)到文件以便后续分析,文件名通常是java_pid<pid>.hprof,其中pid为该程序的进程号。
- -XX:HeapDumpPath=<path> 用来指定heap转存文件的存储路径,需要指定的路径下有足够的空间来保存转存文件。
- -XX:OnOutOfMemoryError 用来指定一个可行性程序或者脚本的路径,当发生OOM的时候,去执行这个脚本。
比如,下面的命令可以使得在发生OOM的时候,Heap被转存到文件/tmp/heapdump.hprof,同时执行Home目录中的cleanup.sh文件:
java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.hprof -XX:OnOutOfMemoryError ="sh ~/cleanup.sh" MyApp
2.7、收集器设置
2.7.1、吞吐量优先收集器的相关选项
衡量JVM垃圾收集器的两个基本指标是吞吐量和停顿时间。
吞吐量是指执行用户代码的时间占总的时间的比例,总的时间包括执行用户代码的时间和垃圾回收占用的时间。在垃圾回收的时候执行用户代码的线程必须暂停,这会导致程序暂时失去响应。停顿时间就是衡量垃圾回收时造成的用户线程暂停的时间。这两个指标在一定程度是相互矛盾的,不可能让一个程序的吞吐量很高的同时停顿时间也短,只能以优先选择一个目标或者折中一下。因此,不同的垃圾回收器会有不同的侧重点。
在Hotspot JVM中,侧重于吞吐量的垃圾回收器是Parallel Scavenge和Parallel Old,它的相关选项如下:
- -XX:+UseParallelOldGC 表示新生代和老生代都使用并行回收器,其中的Old表示老生代的意思,而不是旧的意思。
- -XX:ParallelGCThreads=n 表示配置多少个线程来回收垃圾。默认的配置是如果处理器的个数小于8,那么就是处理器的个数;如果处理器大于8,它的值就是3+5N/8。也可以根据程序的需要去设置这个值,比如你的机器有16核,上面有4个Java程序,那么设置将这个值设置为4比较合理,因为JVM不会去探测同一机器上有多少个Java程序。
- -XX:UseAdaptiveSizePolicy 表示是否开启自适应策略,打开这个开关后,JVM自动调节JVM的新生代大小,Eden和Survivor的比例等参数。用户只需要设置期望的吞吐量(-XX:GCTimeRatio)和期望的停顿时间(-XX:MaxGCPauseMillis)。然后,JVM会尽量去向用户期望的方向去优化。
此外,如果机器只有一个核的话,采用并行回收器可能得不偿失,因为多个回收线程会争抢CPU资源,反而造成更大的消耗。这时,就最好采用串行回收器,相关的参数是-XX:+UseSerialGC
2.7.2、CMS收集器
CMS收集器(ConcurrentMarkandSweep),是一个关注系统停顿时间的收集器。它的主要思想是把收集器分成了不同的阶段,其中某些阶段是可以用户程序并行的,从而减少了整体的系统停顿时间。它主要分成了以下几个阶段:
- 初始标记 initial mark
- 并发标记 concurrent mark
- 重新标记 remark
- 并发清理 concurrent clean
- 并发重置 concurrent reset
CMS虽然能减少系统的停顿时间,但是它也有其缺点:
1. 从它的名字可以看出,它是一个标记-清除收集器,也就说运行了一段时间后,内存会产生碎片,从而导致无法找到连续空间来分配大对象。
2. CMS收集器在运行过程中会占用一些内存,同时系统还在运行,如果系统产生新对象的速度比CMS清理的速度快的话,会导致CMS运行失败。
当上面的任何一种情况发生的时候,JVM就会触发一次Full GC,会导致JVM停顿较长时间。
它的相关选项如下:
- -XX:+UseConcMarkSweepGC 表示老年代开启CMS收集器,而新生代默认会使用并行收集器。
- -XX:ConcGCThreads 指定CMS的并发阶段用多少个线程来执行垃圾回收。
- -XX:CMSInitiatingOccupancyFraction 指定在老生代用掉多少内存后开始进行垃圾回收。与吞吐量优先的回收器不同的是,吞吐量优先的回收器在老生代内存用尽了以后才开始进行收集,这对CMS来讲是不行的,因为吞吐量优先的垃圾回收器运行的时候会停止所有用户线程,所以不会产生新的对象,而CMS运行的时候,用户线程还有可能产生新的对象,所以不能等到内存用光后才开始运行。比如-XX:CMSInitiatingOccupancyFraction=75表示老生代用掉75%后开始回收垃圾。默认值是68。
- -XX:+ExplicitGCInvokesConcurrent 如果在代码里面显式调用System.gc(),那么它还是会执行Full GC从而导致用户线程被暂停。采用这个选项使得显式触发GC的时候还是使用CMS收集器。
- -XX:+DisableExplicitGC 一个相关的选项,这个选项是禁止显式调用GC
2.8、GC日志相关的选项
分析GC问题不可避免地要查看GC日志,下面是一些GC日志相关的选项:
-
-XX:+PrintGC,等同于-verbose:gc 表示打开简化的GC日志,相关输出如下:
[GC 425355K->351685K(506816K), 0.2175300 secs] [Full GC 500561K->456058K(506816K), 0.6421920 secs]
其中以GC开头的行表示发生了一次Minor GC,后面的数字表示收集前后Heap空间的占用量,圆括号里面表示Heap可用的总大小,最后的数字表示用了多少时间。比如:上面的例子中,表示在这次GC新生代空间占用从425355K降到了351685K,总的新生代空间为506816K,这次GC耗时0.22秒。
通过这个选项只能看到一些基本信息,而且所有收集器的输出在这个模式下都是一样的。
-
-XX:+PrintGCDetails 在发生垃圾回收时打印内存回收日志,并在进程退出时输出当前内存各区域分配情况。
-
-XX:+PrintGCTimeStamps 打印GC发生时相对于JVM启动时的时间。
-
-XX:+PrintGCDateStamps 打印出GC发生的具体时间。
比如,以下是-XX:+PrintGCTimeStamps的输出
0,185: [GC 66048K->53077K(251392K), 0,0977580 secs] 0,323: [GC 119125K->114661K(317440K), 0,1448850 secs] 0,603: [GC 246757K->243133K(375296K), 0,2860800 secs]
以下是两个都打开后的输出:
2014-12-26T17:52:38.613-0800: 3.395: [GC 139776K->58339K(506816K), 0.1442900 secs]
- -Xloggc:<file> 表示把GC日志写入到一个文件中去,而不是打印到标准输出中。
- -XX:+PrintHeapAtGC 每一次GC前和GC后,都打印堆信息。
- -XX:+TraceClassLoading 监控类的加载。打印内容示例: [Opened C:\Program Files\java\jdk1.8.0_45\jre\lib\rt.jar] [Loaded java.lang.Object from C:\Program Files\java\jdk1.8.0_45\jre\lib\rt.jar]... 。
- -XX:+PrintGCApplicationStoppedTime 打印GC时线程的停顿时间,如: Total time for which application threads were stopped: 0.0000660 seconds, Stopping threads took: 0.0000134 seconds 。
需要注意的是:这些和GC日志相关的选项可以在JVM已经启动后再开启,可以通过jinfo这个工具去设置(具体可以参见jinfo的使用),这样就可以在需要诊断问题的时候再开启GC日志。
最后给一个示例:
-Xmx3550m:设置JVM最大堆内存为3550M。 -Xms3550m:设置JVM初始堆内存为3550M。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。 -Xss128k:设置每个线程的栈大小。JDK5.0以后每个线程栈大小为1M,之前每个线程栈大小为256K。应当根据应用的线程所需内存大小进行调整。在相同物理内存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。需要注意的是:当这个值被设置的较大(例如>2MB)时将会在很大程度上降低系统的性能。 -Xmn2g:设置年轻代大小为2G。在整个堆内存大小确定的情况下,增大年轻代将会减小年老代,反之亦然。此值关系到JVM垃圾回收,对系统性能影响较大,官方推荐配置为整个堆大小的3/8。 -XX:NewSize=1024m:设置年轻代初始值为1024M。 -XX:MaxNewSize=1024m:设置年轻代最大值为1024M。 -XX:PermSize=256m:设置持久代初始值为256M。 -XX:MaxPermSize=256m:设置持久代最大值为256M。 -XX:NewRatio=4:设置年轻代(包括1个Eden和2个Survivor区)与年老代的比值。表示年轻代比年老代为1:4。 -XX:SurvivorRatio=4:设置年轻代中Eden区与Survivor区的比值。表示2个Survivor区(JVM堆内存年轻代中默认有2个大小相等的Survivor区)与1个Eden区的比值为2:4,即1个Survivor区占整个年轻代大小的1/6。 -XX:MaxTenuringThreshold=7:表示一个对象如果在Survivor区(救助空间)移动了7次还没有被垃圾回收就进入年老代。如果设置为0的话,则年轻代对象不经过Survivor区,直接进入年老代,对于需要大量常驻内存的应用,这样做可以提高效率。如果将此值设置为一个较大值,则年轻代对象会在Survivor区进行多次复制,这样可以增加对象在年轻代存活时间,增加对象在年轻代被垃圾回收的概率,减少Full GC的频率,这样做可以在某种程度上提高服务稳定性。
3、Java代码获取JVM相关参数
可以借助java.lang.management.*:
java.lang.management: for monitoring and management of the Java virtual machine and other components in the Java runtime. It allows both local and remote monitoring and management of the running Java virtual machine.
代码示例:
1 package cn.edu.buaa.jvmbook; 2 3 import java.lang.management.CompilationMXBean; 4 import java.lang.management.GarbageCollectorMXBean; 5 import java.lang.management.ManagementFactory; 6 import java.lang.management.MemoryMXBean; 7 import java.lang.management.MemoryPoolMXBean; 8 import java.lang.management.MemoryUsage; 9 import java.lang.management.OperatingSystemMXBean; 10 import java.lang.management.RuntimeMXBean; 11 import java.lang.management.ThreadMXBean; 12 import java.util.List; 13 14 /** 15 * @author zsm 16 * @date 2017年1月9日 上午10:37:48 17 */ 18 public class GetJVMParameter { 19 public static void main(String[] args) { 20 21 MemoryMXBean memorymbean = ManagementFactory.getMemoryMXBean(); 22 MemoryUsage usage = memorymbean.getHeapMemoryUsage(); 23 System.out.println("INIT HEAP: " + usage.getInit() / 1024 / 1024); 24 System.out.println("MAX HEAP: " + usage.getMax() / 1024 / 1024); 25 System.out.println("USE HEAP: " + usage.getUsed() / 1024 / 1024); 26 System.out.println("\nFull Information:"); 27 System.out.println("Heap Memory Usage: " + memorymbean.getHeapMemoryUsage()); 28 System.out.println("Non-Heap Memory Usage: " + memorymbean.getNonHeapMemoryUsage()); 29 30 List<String> inputArguments = ManagementFactory.getRuntimeMXBean().getInputArguments(); 31 System.out.println("===================java options=============== "); 32 System.out.println(inputArguments); 33 34 System.out.println("=======================通过java来获取相关系统状态============================ "); 35 System.out.println("当前堆内存大小totalMemory " + (int) Runtime.getRuntime().totalMemory() / 1024 / 1024 + " M");// 当前堆内存大小 36 System.out.println("空闲堆内存大小freeMemory " + (int) Runtime.getRuntime().freeMemory() / 1024 / 1024 + " M");// 空闲堆内存大小 37 System.out.println("最大可用总堆内存maxMemory " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + " M");// 最大可用总堆内存大小 38 39 System.out.println("=======================OperatingSystemMXBean============================ "); 40 OperatingSystemMXBean osm = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); 41 // System.out.println(osm.getFreeSwapSpaceSize()/1024); 42 // System.out.println(osm.getFreePhysicalMemorySize()/1024); 43 // System.out.println(osm.getTotalPhysicalMemorySize()/1024); 44 45 // 获取操作系统相关信息 46 System.out.println("osm.getArch() " + osm.getArch()); 47 System.out.println("osm.getAvailableProcessors() " + osm.getAvailableProcessors()); 48 // System.out.println("osm.getCommittedVirtualMemorySize() "+osm.getCommittedVirtualMemorySize()); 49 System.out.println("osm.getName() " + osm.getName()); 50 // System.out.println("osm.getProcessCpuTime() "+osm.getProcessCpuTime()); 51 System.out.println("osm.getVersion() " + osm.getVersion()); 52 // 获取整个虚拟机内存使用情况 53 System.out.println("=======================MemoryMXBean============================ "); 54 MemoryMXBean mm = (MemoryMXBean) ManagementFactory.getMemoryMXBean(); 55 System.out.println("getHeapMemoryUsage " + mm.getHeapMemoryUsage()); 56 System.out.println("getNonHeapMemoryUsage " + mm.getNonHeapMemoryUsage()); 57 // 获取各个线程的各种状态,CPU 占用情况,以及整个系统中的线程状况 58 System.out.println("=======================ThreadMXBean============================ "); 59 ThreadMXBean tm = (ThreadMXBean) ManagementFactory.getThreadMXBean(); 60 System.out.println("getThreadCount " + tm.getThreadCount()); 61 System.out.println("getPeakThreadCount " + tm.getPeakThreadCount()); 62 System.out.println("getCurrentThreadCpuTime " + tm.getCurrentThreadCpuTime()); 63 System.out.println("getDaemonThreadCount " + tm.getDaemonThreadCount()); 64 System.out.println("getCurrentThreadUserTime " + tm.getCurrentThreadUserTime()); 65 66 // 当前编译器情况 67 System.out.println("=======================CompilationMXBean============================ "); 68 CompilationMXBean gm = (CompilationMXBean) ManagementFactory.getCompilationMXBean(); 69 System.out.println("getName " + gm.getName()); 70 System.out.println("getTotalCompilationTime " + gm.getTotalCompilationTime()); 71 72 // 获取多个内存池的使用情况 73 System.out.println("=======================MemoryPoolMXBean============================ "); 74 List<MemoryPoolMXBean> mpmList = ManagementFactory.getMemoryPoolMXBeans(); 75 for (MemoryPoolMXBean mpm : mpmList) { 76 System.out.println("getUsage " + mpm.getUsage()); 77 System.out.println("getMemoryManagerNames " + mpm.getMemoryManagerNames().toString()); 78 } 79 // 获取GC的次数以及花费时间之类的信息 80 System.out.println("=======================GarbageCollectorMXBean============================ "); 81 List<GarbageCollectorMXBean> gcmList = ManagementFactory.getGarbageCollectorMXBeans(); 82 for (GarbageCollectorMXBean gcm : gcmList) { 83 System.out.println("getName " + gcm.getName()); 84 System.out.println("getMemoryPoolNames " + gcm.getMemoryPoolNames()); 85 } 86 // 获取运行时信息 87 System.out.println("=======================RuntimeMXBean============================ "); 88 RuntimeMXBean rmb = (RuntimeMXBean) ManagementFactory.getRuntimeMXBean(); 89 System.out.println("getClassPath " + rmb.getClassPath()); 90 System.out.println("getLibraryPath " + rmb.getLibraryPath()); 91 System.out.println("getVmVersion " + rmb.getVmVersion()); 92 93 } 94 }
输出:
1 INIT HEAP: 16 2 MAX HEAP: 19 3 USE HEAP: 1 4 5 Full Information: 6 Heap Memory Usage: init = 16777216(16384K) used = 1175064(1147K) committed = 15728640(15360K) max = 19922944(19456K) 7 Non-Heap Memory Usage: init = 2555904(2496K) used = 4101808(4005K) committed = 8060928(7872K) max = -1(-1K) 8 ===================java options=============== 9 [-Xms15M, -Xmx20M, -Xmn10M, -XX:SurvivorRatio=8, -Dfile.encoding=GBK] 10 =======================通过java来获取相关系统状态============================ 11 当前堆内存大小totalMemory 15 M 12 空闲堆内存大小freeMemory 13 M 13 最大可用总堆内存maxMemory 19 M 14 =======================OperatingSystemMXBean============================ 15 osm.getArch() amd64 16 osm.getAvailableProcessors() 4 17 osm.getName() Windows 8.1 18 osm.getVersion() 6.3 19 =======================MemoryMXBean============================ 20 getHeapMemoryUsage init = 16777216(16384K) used = 1175064(1147K) committed = 15728640(15360K) max = 19922944(19456K) 21 getNonHeapMemoryUsage init = 2555904(2496K) used = 4152552(4055K) committed = 8060928(7872K) max = -1(-1K) 22 =======================ThreadMXBean============================ 23 getThreadCount 5 24 getPeakThreadCount 5 25 getCurrentThreadCpuTime 93750000 26 getDaemonThreadCount 4 27 getCurrentThreadUserTime 62500000 28 =======================CompilationMXBean============================ 29 getName HotSpot 64-Bit Tiered Compilers 30 getTotalCompilationTime 4 31 =======================MemoryPoolMXBean============================ 32 getUsage init = 2555904(2496K) used = 1133120(1106K) committed = 2555904(2496K) max = 251658240(245760K) 33 getMemoryManagerNames [Ljava.lang.String;@659e0bfd 34 getUsage init = 0(0K) used = 2795920(2730K) committed = 4980736(4864K) max = -1(-1K) 35 getMemoryManagerNames [Ljava.lang.String;@2a139a55 36 getUsage init = 0(0K) used = 305448(298K) committed = 524288(512K) max = 1073741824(1048576K) 37 getMemoryManagerNames [Ljava.lang.String;@15db9742 38 getUsage init = 8388608(8192K) used = 1175064(1147K) committed = 8388608(8192K) max = 8388608(8192K) 39 getMemoryManagerNames [Ljava.lang.String;@6d06d69c 40 getUsage init = 1048576(1024K) used = 0(0K) committed = 1048576(1024K) max = 1048576(1024K) 41 getMemoryManagerNames [Ljava.lang.String;@7852e922 42 getUsage init = 6291456(6144K) used = 0(0K) committed = 6291456(6144K) max = 10485760(10240K) 43 getMemoryManagerNames [Ljava.lang.String;@4e25154f 44 =======================GarbageCollectorMXBean============================ 45 getName PS Scavenge 46 getMemoryPoolNames [Ljava.lang.String;@70dea4e 47 getName PS MarkSweep 48 getMemoryPoolNames [Ljava.lang.String;@5c647e05 49 =======================RuntimeMXBean============================ 50 getClassPath D:\eclipse\workspace\svn_local\TestJustFor\bin 51 getLibraryPath C:\Program Files\java\jdk1.8.0_45\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/java/jdk1.8.0_45//bin/../jre/bin/server;C:/Program Files/java/jdk1.8.0_45//bin/../jre/bin;C:/Program Files/java/jdk1.8.0_45//bin/../jre/lib/amd64;D:\soft_install\ImageMagick-7.0.1-Q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;D:\soft_install;D:\soft_install\svn\bin;C:\Program Files\java\jdk1.8.0_45\\bin;C:\Program Files\java\jdk1.8.0_45\\jre\bin;C:\Users\zsm\AppData\Local\atom\bin;D:\apache-maven-3.2.5\bin;D:\soft_install\cywin\bin;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;D:\soft_install\nodejs\;C:\Program Files (x86)\CMake\bin;D:\gradle-3.1-all\gradle-3.1\\bin;D:\soft_install\python\Scripts\;D:\soft_install\python\;C:\Users\zsm\AppData\Roaming\npm;D:\soft_install\Microsoft VS Code\bin;C:\Users\zsm\AppData\Local\Microsoft\WindowsApps;;D:\eclipse;;. 52 getVmVersion 25.45-b02
4、JVM调优实践(踩坑记)
Java死锁情形模拟
让两个线程分别持有一个锁,然后分别申请对方的锁即可。有很多种实现情形,一种示例:
Object lock1 = new Object(); Object lock2 = new Object(); Thread t1=new Thread(){ @Override public void run() { synchronized (lock1){ try { System.out.println("t1: get lock 1"); sleep(5000); synchronized (lock2){ System.out.println("t1: get lock 2"); } } catch (InterruptedException e) { throw new RuntimeException(e); } } } }; Thread t2=new Thread(){ @Override public void run() { synchronized (lock2){ try { System.out.println("t2: get lock 2"); sleep(5000); synchronized (lock1){ System.out.println("t2: get lock 1"); } } catch (InterruptedException e) { throw new RuntimeException(e); } } } }; t1.start(); t2.start();
此时通过 jstack -l 进程号 即可看到死锁情况,示例:
Found one Java-level deadlock: ============================= "Thread-1": waiting to lock monitor 0x00007fcdcb80d8a8 (object 0x000000079569e888, a java.lang.Object), which is held by "Thread-0" "Thread-0": waiting to lock monitor 0x00007fcdcb80b018 (object 0x000000079569e898, a java.lang.Object), which is held by "Thread-1" Java stack information for the threads listed above: =================================================== "Thread-1": at org.example.Main$2.run(Main.java:45) - waiting to lock <0x000000079569e888> (a java.lang.Object) - locked <0x000000079569e898> (a java.lang.Object) "Thread-0": at org.example.Main$1.run(Main.java:29) - waiting to lock <0x000000079569e898> (a java.lang.Object) - locked <0x000000079569e888> (a java.lang.Object) Found 1 deadlock.
-XX:ActiveProcessorCount
-XX:ActiveProcessorCount :用于设置JVM使用的CPU核数限制,0表示不限制。
实际场景:SenseStudy服务端在导入课程包zip文件时,将课程包依赖的图片等资源用线程池并发上传。线程池大小设置为 Runtime.getRuntime().availableProcessors() 。本地运行与预期一致,线上运行(docker环境)发现线程池大小始终为1。排查发现可能是所用的 openjdk:8-jdk-alpine 默认会将ActiveProcessorCount设为1。解决:设置为0表示不进行限制。
JVM不定时崩溃
ParallelCMSThreads、ParallelGCThreads 大小关系的bug导致JVM不定时崩溃。
ParallelCMSThreads: 老年代并行收集线程数(默认 ParallelCMSThreads = (ParallelGCThreads + 3) / 4)
ParallelGCThreads:年轻代并行收集线程数(默认 ParallelGCThreads = (ncpus <= 8) ? ncpus : 3 + ((ncpus * 5) / 8))
情景(JVM不定时崩溃):2核4G内存的服务器上设置了前者为4而后者未设置,因此后者为2,从而 ParallelCMSThreads > ParallelGCThreads 。在Java 1.6、1.7中,当前者大于后者时VM可能不定时崩溃,是个bug。参阅这篇文章
解决:设置参数使得 ParallelCMSThreads ≤ ParallelGCThreads,或者不设置两参数此时也能满足该关系。
发布或重启服务时请求响应慢、CPU load高
来自这篇文章
问题:发布或重启时通过JVisualVM发现CPU load有大抖动,且请求的响应慢;通过jstack打印栈信息分析发现 C2 CompilerThread 两个线程cpu使用率降低后load以及响应时间也马上恢复了正常。
分析:开始时即时编译等编译优化手段未生效故慢,方法或循环代码执行次数多后即时编译为机器码,从而执行效率大增。
解决:
尽早进行编译优化:程序启动后先进行访问预热以让触发代码即时编译,然后才放入业务流量。
尽快完成编译优化:
增减 C2 CompilerThread 线程数;
使用更高级的编译模式Trierdd。编译方式有三种:1)Client模式;2)Server模式;3)Tiered模式,默认是Server模式。
内存不足导致FullGC失败从而程序假死
应用假死的排查和解决(20221129阿里面试题)。先重启,然后分析、排查可能的原因:
硬件资源:CPU、内存、磁盘用量查看,top、free、du。
Tomcat容器线程耗尽:Tomcat日志查看,线程配置。
Java应用则通常是因JVM内存耗尽、死锁等:通过JVM日志、JVisualVM等工具排查等。如何判断假死与否?访问接口看响不响应等。
1 通常是FullGC时无法分配足够内存(Allocation Failure)导致STW很久,这期间应用线程无法得到CPU执行权限从而看上去假死,可通过JVM gc日志排查然后通过jmap命令 jmap -dump:format=b,file=32443jvm.bin pid 将内存快照保存下来分析。
一个实例:
查GC日志发现是内存分配失败导致STW太久(300s)-> 为何gc失败?内存不够,Allocation Failure -> 为何内存不够?jmap 命令导出内存快照分析出大量的同一类线程占用太多内存 -> 为什么会有大量线程?分析该线程堆栈看是什么代码导致 -> 某【创建定时任务线程去定期清理数据的】方法线程不安全导致高并发场景下被多个请求触发重复生成多个定时任务线程。
2 也可能是死锁或线程都进入等待状态导致。比如生产者消费者同步模型中,编码不当导致业务线程都进入WAITING状态未能被唤醒。
其他。