Quick-reference - Link
http://docs.oracle.com/cd/E21764_01/integration.1111/e10223/01_components.htm
http://docs.oracle.com/cd/E21764_01/integration.1111/e10223/01_components.htm
-server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:MaxNewSize=256m -XX:NewSize=256m -Xms768m -Xmx768m -XX:SurvivorRatio=128 -XX:MaxTenuringThreshold=0 -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
-server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:MaxNewSize=32m -XX:NewSize=32m -Xms768m -Xmx768m -XX:SurvivorRatio=128 -XX:MaxTenuringThreshold=0 -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
-server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxNewSize=64m -XX:NewSize=64m -Xms1536m -Xmx1536m -XX:SurvivorRatio=128 -XX:MaxTenuringThreshold=0 -XX:CMSInitiatingOccupancyFraction=60 -Dsun.rmi.dgc.server.gcInterval=0x7FFFFFFFFFFFFFFE -Dsun.rmi.dgc.client.gcInterval=0x7FFFFFFFFFFFFFFE
-XX:+UseTLAB
—Uses thread-local object allocation blocks. This improves concurrency by reducing contention on the shared heap lock.-XX:+UseParNewGC
—Uses a parallel version of the young generation copying collector alongside the default collector. This minimizes pauses by using all available CPUs in parallel. The collector is compatible with both the default collector and the Concurrent Mark and Sweep (CMS) collector.-Xms, -Xmx
—Places boundaries on the heap size to increase the predictability of garbage collection. T
he heap size is limited in replica servers so that even Full GCs do not trigger SIP retransmissions. -Xms
sets the starting size to prevent pauses caused by heap expansion.-XX:NewSize
—Defines the minimum young generation size. BEA recommends testing your production applications starting with a young generation size of 1/3 the total heap size. Using a larger young generation size causes fewer minor collections to occur but may compromise response time goals by cause longer-running full collections.-XX:MaxTenuringThreshold=0
—Makes the full NewSize available to every NewGC cycle, and reduces the pause time by not evaluating tenured objects. Technically, this setting promotes all live objects to the older generation, rather than copying them.-XX:SurvivorRatio=128
—Specifies a high survivor ratio, which goes along with the zero tenuring threshold to ensure that little space is reserved for absent survivors.-XX:+UseConcMarkSweepGC
selects the CMS collector.System.gc()
and Runtime.getRuntime().gc()
methods instruct the JVM to run the garbage collector to recycle unused objects. The HotSpot implementation of these methods currently stops all application threads to collect the entire heap, which can result in a lengthy pause particularly when the heap is large. This works against the goal of the CMS collector to keep pauses short.System.gc()
or Runtime.getRuntime().gc()
call. To enable this feature, add the option-XX:+ExplicitGCInvokesConcurrent
java
command line.-verbose:gc
and-Xloggc:<file>
. It also calculates garbage collection related performance metrics (throughput, accumulated pauses, longest pause, etc.). This can be very useful when tuning the garbage collection of a particular application by changing generation sizes or setting the initial heap size. See here for a useful summary of garbage collection related JVM parameters. For more information on tuning garbage collection on Sun JVMs, take a look at the documentation provided by Oracle.-Xloggc:<file> [-XX:+PrintGCDetails]
-verbose:gc
-verbose:gc
option -verbose:gc
-Xverbosegc
-verbose:memory
-Xloggc:<file> -XX:+PrintGCDetails
GCViewer 1.32 ============= GCViewer is a little tool that visualizes verbose GC output generated by Sun / Oracle, IBM, HP and BEA Java Virtual Machines. It is free software released under GNU LGPL. You can start GCViewer (gui) by simply double-clicking on gcviewer-1.3x.jar or running java -jar gcviewer-1.3x.jar (it needs a java 1.6 vm to run). For a cmdline based report summary just type: java -jar gcviewer-1.3x.jar gc.log summary.csv to generate a report. Supported verbose:gc formats are: - Sun / Oracle JDK 1.7 with option -Xloggc:<file> [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps] - Sun / Oracle JDK 1.6 with option -Xloggc:<file> [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps] - Sun JDK 1.4/1.5 with the option -Xloggc:<file> [-XX:+PrintGCDetails] - Sun JDK 1.2.2/1.3.1/1.4 with the option -verbose:gc - IBM JDK 1.3.1/1.3.0/1.2.2 with the option -verbose:gc - IBM iSeries Classic JVM 1.4.2 with option -verbose:gc - HP-UX JDK 1.2/1.3/1.4.x with the option -Xverbosegc - BEA JRockit 1.4.2/1.5 with the option -verbose:memory Best results are achieved with: -Xloggc:<file> -XX:+PrintGCDetails -XX:+PrintGCDateStamps Hendrik Schreiber wrote GCViewer up to 1.29. What you are seeing here is based on his very good work. Links to detailed descriptions of many JVM parameters relevant to garbage collection can be found in the links section of https://github.com/chewiebug/GCViewer/wiki GCViewer shows a number of lines etc. in a chart (first tab). These are: - Full GC Lines: o Black vertical line at every Full GC - Inc GC Lines: o Cyan vertical line at every Incremental GC - GC Times Line: o Green line that shows the length of all GCs - GC Times Rectangles: o Dark grey rectangle at every Full GC o Light grey rectangle at every Incremental GC o Grey rectangle at every 'normal' GC - Total Heap: o Red line that shows heap size - Tenured Generation: o Magenta area that shows the size of the tenured generation (not available without PrintGCDetails) - Young Generation: o Orange area that shows the size of the young generation (not available without PrintGCDetails) - Used Heap: o Blue line that shows used heap size - Initial mark level: o Yellow line that shows the heap usage at "initial-mark" event (only available when the gc algorithm uses concurrent collections, which is the case for CMS and G1) - Concurrent collections o Cyan vertical line for every begin (concurrent-mark-start) and pink vertical line for every end (CMS-concurrent-reset / G1: concurrent-cleanup-end) of a concurrent collection cycle In the second tab ("Event details") it shows details about the events it parsed: E.g. events like the following 24.187: [GC 24.188: [ParNew: 93184K->5464K(104832K), 0.0442895 secs] \ 93184K->5464K(1036928K), 0.0447149 secs] \ [Times: user=0.39 sys=0.07, real=0.05 secs] are shown in one line as GC ParNew: <number of events parsed>, <min duration>, <max duration>... Events like these 4183.962: [Full GC 4183.962: [CMS: 32957K->40326K(932096K), 2.3313389 secs] \ 76067K->40326K(1036928K), [CMS Perm : 43837K->43453K(43880K)], 2.3339606 secs] \ [Times: user=2.33 sys=0.01, real=2.33 secs] are shown as Full GC CMS: CMS Perm : <number of events parsed> ... So for every line the text is extracted (not always every part of it). This allows a user which is familiar with the text log files to find out more details about the events that occurred. Metrics ======= GCViewer provides some metrics to help you interpret the graph. Note that some metrics based on averages are shown along with their standard deviation. If it is obvious that the standard deviation is fairly big in comparison to the average, the values are grayed out, indicating that actual values are much smaller or bigger than the average. Summary ------- - Footprint: o Maximal amount of memory allocated - Freed Memory: o Total amount of memory that has been freed - Freed Mem/Min: o Amount of memory that has been freed per minute - Total Time: o Time data was collected for (only Sun 1.5/1.4/1.2.2 and IBM 1.3.1/1.3.0/1.2.2) - Acc Pauses: o Sum of all pauses due to GC - Throughput: o Time percentage the application was NOT busy with GC - Full GC Performance: o Performance of full collections. Note that all collections that include a collection of the tenured generation or are marked with "Full GC" are considered Full GC. - GC Performance: o Performance of minor collections. These are collections that are not full according to the definition above. Memory ------ - Total heap (usage / alloc max): o Max memory usage / allocation in total heap (the last is the same as "footprint" in Summary) - Tenured heap (usage / alloc max): o Max memory usage / allocation in tenured space - Young heap (usage / alloc max): o Max memory usage / allocation in young space - Perm heap (usage / alloc max): o Max memory usage / allocation in perm space - Avg after full GC: o The average heap memory consumption after a full collection - Avg after GC: o The average heap memory consumption after a minor collection - Freed Memory: o Total amount of memory that has been freed - Freed by full GC: o Amount of memory that has been freed by full collections - Freed by GC: o Amount of memory that has been freed by minor collections - Avg freed full GC: o Average amount of memory that has been freed by full collections - Avg freed GC: o Average amount of memory that has been freed by minor collections - Avg rel inc after FGC: o Average relative increase in memory consumption between full collections. This is the average difference between the memory consumption after a full collection to the memory consumption after the next full collection. - Avg rel inc after GC: o Average relative increase in memory consumption between minor collections. This is the average difference between the memory consumption after a minor collection to the memory consumption after the next minor collection. This can be used as an indicator for the amount of memory that survives minor collections and has to be moved to the survivor spaces or the tenured generation. This value added to "Avg freed GC" gives you an idea about the size of the young generation in case you don't have PrintGCDetails turned on. - Slope full GC: o Slope of the regression line for the memory consumption after full collections. This can be used as an indicator for the increase in indispensable memory consumption (base footprint) of an application over time. - Slope GC: o Average of the slope of the regression lines for the memory consumption after minor collections in between full collections. That is, if you have two full collections and many minor collections in between, GCViewer will calculate the slope for the minor collections up to the first full collection, then the slope of the minor collections between the first and the second full collection. Then it will compute a weighted average (each slope wil be weighted with the number of measuring points it was computed with). - initiatingOccFraction (avg / max) o CMS GC kicks in before tenured generation is filled. InitiatingOccupancyFraction tells you the avg / max usage in % of the tenured generation, when CMS GC started (initial mark). This value can be set manually using -XX:CMSInitiatingOccupancyFraction=<value>. - avg promotion o Promotion means the size of objects that are promoted from young to tenured generation during a young generation collection. Avg promotion shows the average amount of memory that is promoted from young to tenured with each young collection (only available with PrintGCDetails) - total promotion o Total promotion shows the total amount of memory that is promoted from young to tenured with all young collections in a file (only available with PrintGCDetails) Pause ----- - Acc Pauses: o Sum of all pauses due to any kind of GC - Number of Pauses: o Count of all pauses due to any kind of GC - Avg Pause: o Average length of a GC pause of any kind - Min / max Pause: o Shortest /longest pause of any kind - Avg pause interval: o avg interval between two pauses of any kind - Min / max pause interval: o Min / max interval between two pauses of any kind - Acc full GC: o Sum of all pauses due to full collections - Number of full GC pauses: o Count of all pauses due to full collections - Acc GC: o Sum of all full GC pauses - Avg full GC: o Average length of a full GC pause - Min / max full GC pause: o Shortest / longest full GC pause - Acc GC: o Sum of all pauses due to minor collections - Number of GC pauses: o Count of all pauses due to minor collections - Avg GC: o Average length of a minor collection pause - Min / max GC pause: o Shortest / longest minor GC pause Notes ===== This is not a perfect tool. However, GCViewer can help you getting a grip on finding out what's going on in your application with regards to garbage collection.
Young collector
|
Old collector
|
JVM option
|
Serial (DefNew)
|
Serial Mark-Sweep-Compact
|
-XX:+UseSerialGC
|
Parallel scavenge (PSYoungGen)
|
Serial Mark-Sweep-Compact (PSOldGen)
|
-XX:+UseParallelGC
|
Parallel scavenge (PSYoungGen)
|
Parallel Mark-Sweep-Compact (ParOldGen)
|
-XX:+UseParallelOldGC
|
Serial (DefNew)
|
Concurrent Mark Sweep
|
-XX:+UseConcMarkSweepGC
-XX:-UseParNewGC |
Parallel (ParNew)
|
Concurrent Mark Sweep
|
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC |
G1
|
-XX:+UseG1GC
|
JVM option
|
Description
|
General options
| |
-verbose:gc or -XX:+PrintGC
|
Print basic GC info
|
-XX:+PrintGCDetails
|
Print more elaborated GC info
|
-XX:+PrintGCTimeStamps
|
Print timestamps for each GC event (seconds count from start of JVM)
|
-Xloggc:<file>
|
Redirects GC output to file instead of console
|
-XX:+PrintTenuringDistribution
|
Print detailed demography of young space after each collection
|
-XX:+PrintTLAB
|
Print TLAB allocation statistics
|
-XX:+PrintGCApplication\
StoppedTime |
Print pause summary after each stop-the-world pause
|
-XX:+PrintGCApplication\
ConcurrentTime |
Print time for each concurrent phase of GC
|
-XX:+HeapDumpAfterFullGC
|
Creates heap dump file after full GC
|
-XX:+HeapDumpBeforeFullGC
|
Creates heap dump file before full GC
|
-XX:+HeapDumpOnOutOfMemoryError
|
Creates heap dump in out-of-memory condition
|
-XX:HeapDumpPath=<path>
|
Specifies path to save heap dumps
|
CMS specific options
| |
-XX:PrintCMSStatistics=<n>
|
Print additional CMS statistics if n >= 1
|
-XX:+PrintCMSInitiationStatistics
|
Print CMS initiation details
|
-XX:PrintFLSStatistics=2
|
Print additional info concerning free lists
|
-XX:PrintFLSCensus=2
|
Print additional info concerning free lists
|
-XX:+CMSDumpAtPromotionFailure
|
Dump useful information about the state of the CMS old generation upon a promotion failure.
|
-XX:+CMSPrintChunksInDump
|
In a CMS dump enabled by option above, include more detailed information about the free chunks.
|
-XX:+CMSPrintObjectsInDump
|
In a CMS dump enabled by option above, include more detailed information about the allocated objects.
|
JVM option
|
Description
|
-Xms<size> -Xmx<size>
or
‑XX:InitialHeapSize=<size>
‑XX:MaxHeapSize=<size> |
Initial and max size of heap space (young space + tenured space). Permanent space does not count to this size.
|
-XX:NewSize=<size>
-XX:MaxNewSize=<size> |
Initial and max size of young space.
|
-XX:NewRatio=<ratio>
|
Alternative way to specify young space size. Sets ration of young vs tenured space (e.g. -XX:NewRatio=2 means that young space will be 2 time smaller than tenuted space).
|
-XX:SurvivorRatio=<ratio>
|
Sets size of single survivor space as a portion of Eden space size (e.g. -XX:NewSize=64m -XX:SurvivorRatio=6 means that each survivor space will be 8m and eden will be 48m).
|
-XX:PermSize=<size>
-XX:MaxPermSize=<size> |
Initial and max size of permanent space.
|
-Xss=<size> or
-XX:ThreadStackSize=<size> |
Sets size of stack area dedicated to each thread. Thread stacks do not count to heap size.
|
-XX:MaxDirectMemorySize=<value>
|
Maximum size of off-heap memory available for JVM
|
JVM option
|
Description
|
-XX:InitialTenuringThreshold=<n>
|
Initial value for tenuring threshold (number of collections before object will be promoted to tenured space).
|
-XX:MaxTenuringThreshold=<n>
|
Max value for tenuring threshold.
|
-XX:PretenureSizeThreshold=<size>
|
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.
|
-XX:+AlwaysTenure
|
Promote all objects surviving young collection immediately to tenured space (equivalent of -XX:MaxTenuringThreshold=0)
|
-XX:+NeverTenure
|
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
|
Use thread local allocation blocks in young space. Enabled by default.
|
-XX:+ResizeTLAB
|
Allow JVM to adaptively resize TLAB for threads.
|
-XX:TLABSize=<size>
|
Initial size of TLAB for thread
|
-XX:MinTLABSize=<size>
|
Minimal allowed size of TLAB
|
JVM option
|
Description
|
Controlling initial mark phase
| |
-XX:+UseCMSInitiatingOccupancyOnly
|
Only use occupancy as a criterion for starting a CMS collection.
|
-XX:CMSInitiating\
OccupancyFraction=<n> |
Percentage CMS generation occupancy to start a CMS collection cycle. A negative value means that CMSTriggerRatio is used.
|
-XX:CMSBootstrapOccupancy=<n>
|
Percentage CMS generation occupancy at which to initiate CMS collection for bootstrapping collection stats.
|
-XX:CMSTriggerRatio=<n>
|
Percentage of MinHeapFreeRatio in CMS generation that is allocated before a CMS collection cycle commences.
|
-XX:CMSTriggerPermRatio=<n>
|
Percentage of MinHeapFreeRatio in the CMS perm generation that is allocated before a CMS collection cycle commences, that also collects the perm generation.
|
-XX:CMSWaitDuration=<timeout>
|
Once CMS collection is triggered, it will wait for next young collection to perform initial mark right after. This parameter specifies how long CMS can wait for young collection.
|
Controlling remark phase
| |
-XX:+CMSScavengeBeforeRemark
|
Force young collection before remark phase.
|
-XX:+CMSScheduleRemark\
EdenSizeThreshold |
If Eden used is below this value, don't try to schedule remark
|
-XX:CMSScheduleRemark\
EdenPenetration=<n> |
The Eden occupancy % at which to try and schedule remark pause
|
-XX:CMSScheduleRemark\
SamplingRatio=<n> |
Start sampling Eden top at least before young generation occupancy reaches 1/
|
Parallel execution
| |
-XX:+UseParNewGC
|
Use parallel algorithm for young space collection.
|
-XX:+CMSConcurrentMTEnabled
|
Use multiple threads for concurrent phases.
|
-XX:ConcGCThreads=<n>
|
Number of parallel threads used for concurrent phase.
|
-XX:+ParallelGCThreads=<n>
|
Number of parallel threads used for stop-the-world phases.
|
CMS incremental mode
| |
-XX:+CMSIncrementalMode
|
Enable incremental CMS mode. Incremental mode is meant for severs with small number of CPU.
|
Miscellaneous options
| |
-XX:+CMSClassUnloadingEnabled
|
If not enabled, CMS will not clean permanent space. You should always enable it in multiple class loader environments such as JEE or OSGi.
|
-XX:+ExplicitGCInvokesConcurrent
|
Let System.gc() trigger concurrent collection instead of full GC.
|
‑XX:+ExplicitGCInvokesConcurrent\
AndUnloadsClasses
|
Same as above but also triggers permanent space collection.
|
JVM option
|
Description
|
-XX:+DisableExplicitGC
|
JVM will ignore application calls to System.gc()
|