Hotspot Jvm Options Cheat Sheet


Java 8
HotSpot JVM options cheatsheet
Alexey Ragozin –
All concrete numbers in JVM options in this card are for illustrational purposes only!
Java Process Memory
Available combinations of garbage collection algorithms in HotSpot JVM
Young collector
Old collectior
JVM Flags
JVM Memory
Serial (DefNew)
Serial Mark Sweep Compact
Java Heap
Parallel scavenge (PSYoungGen)
Serial Mark Sweep Compact (PSOldGen)
Young Gen
Parallel scavenge (PSYoungGen)
Parallel Mark Sweep Compact (ParOldGen)
Parallel (ParNew)
Serial Mark Sweep Compact
Serial (DefNew)
Concurrent Mark Sweep
-XX:+UseParNewGC -XX:+UseConcMarkSweepGC
Parallel (ParNew)
Concurrent Mark Sweep
Garbage First (G1)
1 - Notice minus before UseParNewGC, which is explicitly disables parallel mode
GC log detail options
GC Log rotation
Memory sizing options
Print basic GC info
Redirects GC output to a file instead of console
-Xms256m or -XX:InitialHeapSize=256m
Initial size of JVM heap (young + old)
Print more details GC info
Enable GC log rotation
-Xmx2g or -XX:MaxHeapSize=2g
Print timestamps for each GC
Size threshold for GC log file
Max size of JVM heap (young + old)
event (seconds count from start of JVM)
Absolute (initial and max) size of
Number GC log files
young space (Eden + 2 Survivours)
Print date stamps at garbage
More logging options
collection events:
2011-09-08T14:20:29.557+0400: [GC...
Alternative way to specify size
Print detailed
of young space. Sets ratio of young vs old space
demography of young space after each collection
Print times for special
means that young space will be 2 time
smaller than old space, i.e. 1/3 of heap size).
(weak, JNI, etc) reference processing during STW pause
Print TLAB allocation statistics
Sets size of single survivor space
Reports if GC is waiting for
relative to Eden space size
Print survivor PLAB details
native code to unpin object in memory
means that each
-XX:NewSize=64m -XX:SurvivorRatio=6
Survivor space will be 8m and Eden will be 48m).
Print old space PLAB details
Add cause of GC in log
Initial and max size of
Print timestamps for
JVM’s metaspace space
individual GC worker thread tasks (very verbose)
Print young space sizing decisions
Thread stack size
-Xss256k (size in bytes) or
Print heap details on GC
-XX:ThreadStackSize=256 (size in Kbytes)
Memory reserved
Print additional information for promotion failure
Print heap details on signal
for compressed class space (64bit only)
Initial size and max
Print summary after each JVM safepoint (including non-GC)
Prints class histogram after full GC
size of code cache area
Maximum amount
Print time for each concurrent phase of GC
Prints class histogram before full GC
of memory available for NIO off-heap byte buffers
- Highly recommended option
- Highly recommended option
Concurrent Mark Sweep (CMS)
Garbage First (G1)
Young space tenuring
CMS initiating options
Initial value for tenuring threshold (number of collections
Size of heap region
before object will be promoted to old space)
Only use predefined occupancy as only criterion for starting
Percentage of heap to keep free.
a CMS collection (disable adaptive behaviour)
Reserved memory is used as last resort to avoid promotion failure.
Max value for tenuring threshold
Percentage CMS generation occupancy to start a CMS cycle.
Max object size
Percentage of (entire) heap occupancy to trigger concurrent GC
A negative value means that
is used.
allowed to be allocated in young space (large objects will be
allocated directly in old space). Thread local allocation
Target number of mixed
bypasses this check, so if TLAB is large enough object
collections after a marking cycle
Percentage CMS generation occupancy at which to initiate
exciding size threshold still may be allocated in young space.
CMS collection for bootstrapping collection stats.
If garbage level is below
Promote all objects surviving
threshold, G1 will not attempt to reclaim memory further
young collection immediately to tenured space
Percentage of MinHeapFreeRatio in CMS generation that is
Confidence level
(equivalent of
allocated before a CMS collection cycle commences.
for MMU/pause prediction
Objects from young space
Target GC pause duration.
will never get promoted to tenured space unless survivor
CMS collection. Useful for deterministic object finalization.
G1 is not deterministic, so no guaranties for GC pause to satisfy this limit.
space is not enough to keep them
CMS Stop-the-World pauses tuning
Thread local allocation
CMS Diagnostic options
Use thread local allocation blocks in eden
Once CMS collection is triggered, it will wait for next young
Print additional CMS statistics. Very verbose if n=2.
collection to perform initial mark right after. This parameter
Let JVM resize TLABs per thread
specifies how long CMS can wait for young collection
Initial size of thread’s TLAB
Print CMS initiation details
Min size of TLAB
Force young collection before remark phase
Parallel processing
Dump useful information about the state of the CMS old
generation upon a promotion failure
den used is below this value, don't try to schedule remark
Number of parallel threads used for concurrent phase.
(with optin above)
Add more detailed information about the free chunks
Eden occupancy
at which to try and schedule remark pause
Number of parallel threads used for stop-the-world phases.
(with optin above)
Add more detailed information about the allocated objects
Enable parallel
Start sampling Eden top at least before young generation occupancy
processing of references during GC pause
reaches 1/ of the size at which we plan to schedule remark
Misc CMS options
CMS Concurrency options
JVM will ignore application calls to
If not enabled, CMS will not clean permanent space. You
may need to enable it for containers such as JEE or OSGi.
Whether parallel initial mark is enabled (enabled by default)
trigger concurrent collection instead of full GC
Enable incremental CMS mode. Incremental mode was meant for
Whether parallel remark is enabled (enabled by default)
Same as above but also triggers permanent space collection.
severs with small number of CPU, but may be used on multicore
servers to benefit from more conservative initiation strategy.
Whether parallel remark of survivor space enabled,
for calculating soft reference TTL based on free heap size
-XX:+CMSOldPLABMin=16 -XX:+CMSOldPLABMax=1024
effective only with option above (enabled by default)
Min and max size of CMS gen PLAB caches per worker per block size
Command to be executed
in case of out of memory.
E.g. “kill -9 %p” on Unix or “taskkill /F /PID %p” on Windows.
Use multiple threads for concurrent phases.
- Options for “deterministic” CMS, they disable some heuristics and
require careful validation


00 votes

Related Articles

Related forms

Related Categories

Parent category: Education