HotSpot GC Options Cheat Sheet v2 | Java Virtual Machine | Thread ...

October 14, 2017 | Author: Anonymous | Category: Java
Share Embed


Short Description

Documents Similar To HotSpot GC Options Cheat Sheet v2. Skip carousel. carousel previouscarousel next. Rapid Addition Wh...

Description

HotSpot JVM GC options cheat-sheet cheat-sheet In this article I have collected a list of options related to GC tuning in JVM. This is not a comprehensive list, I have collected only options which I use in practice (or at least understand why I may want to use t hem). Compared to previous version a few useful diagnostic options were added. Additionally section for G1 specific options was introduced.

HotSpot GC collectors HotSpot JVM may use one of 6 com binations of garbage collection algorithms listed below. Young collector

Old collector

JVM option

Serial (DefNew) Parallel scavenge (PSYoungGen) Parallel scavenge (PSYoungGen) Parallel (ParNew_ Serial (DefNew)

Serial Mark-Sweep-Compact Serial Mark-Sweep-Compact (PSOldGen) Parallel Mark-Sweep-Compact (ParOldGen) Serial Mark-Sweep-Compact Concurrent Mark Sweep

-XX:+UseSerialGC

Parallel (ParNew)

Concurrent Mark Sweep

G1

-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:-UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseG1GC

GC logging options Please note that many of logging options could be modified on r unning JVM using JMX (e.g. via JConsole). JVM option

Description

General options -verbose:gc or -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCTaskTimeStamps -Xloggc: -XX:+PrintTenuringDistribution -XX:+PrintTLAB -XX:+PrintReferenceGC -XX:+PrintJNIGCStalls -XX:+PrintGCApplicationStoppedTime

Page 1

Print basic GC info Print more elaborated GC info Print timestamps for each GC event (seconds count from start of JVM) Print date stamps at garbage collection events (e.g. 2011-09-08T14:20:29.55 2011-09-08T14:20:29.557+0400: 7+0400: [GC... ) Print timestamps for individual GC worker thread tasks (very verbose) Redirects GC output to a file instead of console Print detailed demography of young space after each collection Print TLAB allocation statistics Print times for weak/soft/JNI/etc reference processing during STW pause Reports if GC is waiting for native code to unpin object in memory Print pause summary after each stop-the-world by Alexey Ragozin - http://blog.ragozin.info

Unlock Instant Access to

HotSpot GC Options Cheat Sheet v2 when you sign up for a free trial Join With Facebook

Name

Email

Password (at least 6 characters)

Join Now By joining, you agree to our Terms of Service and Privacy Policy

-XX:+PrintGCApplicationConcurrentTime -XX:+PrintClassHistogramAfterFullGC -XX:+PrintClassHistogramBeforeFullGC -XX:+HeapDumpAfterFullGC -XX:+HeapDumpBeforeFullGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=

pause Print time for each concurrent phase of GC Prints class histogram after full GC Prints class histogram before full GC Creates heap dump file after full GC Creates heap dump file before full GC Creates heap dump in out-of-memory condition Specifies path to save heap dumps

CMS specific options -XX:PrintCMSStatistics= -XX:+PrintCMSInitiationStatistics -XX:PrintFLSStatistics=2 -XX:PrintFLSCensus=2 -XX:+PrintPromotionFailure -XX:+CMSDumpAtPromotionFailure -XX:+CMSPrintChunksInDump -XX:+CMSPrintObjectsInDump

Print additional CMS statistics if n >= 1 Print CMS initiation details Print additional info concerning free lists Print additional info concerning free lists Print additional diagnostic information following promotion failure Dump useful information about the state of the CMS old generation upon a promotion failure. In a CMS dump enabled by option above, include more detailed information about the free chunks. In a CMS dump enabled by option above, include more detailed information about the allocated objects.

Unlock Instant Access to

HotSpot GC Options Cheat Sheet v2 when you sign up for a free trial Join With Facebook

Name

Email

Password (at least 6 characters)

Join Now By joining, you agree to our Terms of Service and Privacy Policy

Young collection tuning JVM option -XX:InitialTenuringThreshold= -XX:MaxTenuringThreshold=

-XX:PretenureSizeThreshold=

-XX:+AlwaysTenure

-XX:+NeverTenure

Description

Initial value for tenuring threshold (number of collections before object will be promoted to tenured space). Max value for tenuring threshold. Max object size allowed to be allocated in young space (large objects will be allocated directly in old space). Thread local allocation bypasses this check so if TLAB is large enough object exciding size threshold still may be allocated in young. Promote all objects surviving young collection immediately to tenured space (equivalent of XX:MaxTenuringThreshold=0) Objects from young space will never get promoted to tenured space while survivor space is large enough to keep them.

Thread local allocation blocks -XX:+UseTLAB -XX:+ResizeTLAB

Use thread local allocation blocks in young space. Enabled by default. Allow JVM to adaptively resize TLAB for

Unlock Instant Access to

HotSpot GC Options Cheat Sheet v2 when you sign up for a free trial Join With Facebook

Name

Email

Password (at least 6 characters)

Join Now By joining, you agree to our Terms of Service and Privacy Policy

mark right after. This parameter specifies how long CMS can wait for young collection. Controlling remark phase -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelSurvivorRemarkEnabled

-XX:+CMSScavengeBeforeRemark -XX:+CMSScheduleRemarkEdenSizeThreshold -XX:CMSScheduleRemarkEdenPenetration= -XX:CMSScheduleRemarkSamplingRatio=

-XX:CMSRemarkVerifyVariant=1

Whether parallel remark enabled (only if ParNewGC), enabled by default Whether parallel remark of survivor space enabled (effective only with option above), enabled by default Force young collection before remark phase. If Eden used is below this value, don't try to schedule remark The Eden occupancy % at which to try and schedule remark pause Start sampling Eden top at least before young generation occupancy reaches 1/ of the size at which we plan to schedule remark Choose variant (1,2) of verification following remark

Parallel execution -XX:+UseParNewGC -XX:+CMSConcurrentMTEnabled

Use parallel algorithm for young space collection. Use multiple threads for concurrent phases.

Unlock Instant Access to

HotSpot GC Options Cheat Sheet v2 when you sign up for a free trial Join With Facebook

Name

Email

Password (at least 6 characters)

Join Now By joining, you agree to our Terms of Service and Privacy Policy

-XX:GCTimeLimit=98

-XX:GCHeapFreeLimit=2

in GC before an OutOfMemory error is thrown Limit of proportion of time spent in GC before an OutOfMemory error is thrown (used with GCHeapFreeLimit) Minimum percentage of free space after a full GC before an OutOfMemoryError is thrown (used with GCTimeLimit)

G1 (garbage first) GC options G1 is still evolving, so table below have known supported JVM ver sion column JVM option

Description

-XX:G1HeapRegionSize=8m

Size of heap region for G1 collector. Region size could be from 1MiB to 32MiB. Default is initial heap size / 2048. Confidence coefficient for G1 pause prediction heuristics It determines the minimum reserve we should have in the heap to minimize the probability of promotion failure GC time per MMU time slice in milliseconds (for G1 only) Time slice for MMU specification in milliseconds (for G1 only). Should be greater than parameter above.

-XX:G1ConfidencePercent=50 -XX:G1ReservePercent=10 -XX:MaxGCPauseMillis=200 -XX:GCPauseIntervalMillis=300

View more...

Comments

Copyright © 2017 DATENPDF Inc.