Here is a list of JVM sizing options:
Sizing description | JVM option flag |
This flag establishes the initial heap size (combined young and tenured space). | XX:InitialHeapSize=3g |
This flag establishes the maximum heap size (combined young and tenured space). | -XX:MaxHeapSize=3g |
This flag establishes the initial and maximum heap size (combined young and tenured space). | -Xms2048m -Xmx3g |
This flag establishes the initial size of young space. | -XX:NewSize=128m |
This flag establishes the maximum size of young space. | -XX:MaxNewSize=128m |
This flag establishes young space size. It uses a ration of young versus tenured space. In the sample flag to the right, 3 means that young space will be three times smaller than tenured space. | -XX:NewRation=3 |
This flag establishes the size of single survivor space as a portion of Eden space size. | -XX:SurvivorRatio=15 |
This flag establishes the initial size of the permanent space. | -XX:PermSize=512m |
This flag establishes the maximum size of the permanent space. | -XX:MaxPermSize=512m |
This flag establishes the size of the stack area dedicated to each thread (in bytes). | -Xss512k |
This flag establishes the size of the stack area dedicated to each thread (in kilobytes). | -XX:ThreadStackSize=512 |
This flag establishes the maximum size of off-heap memory available to the JVM. | -XX:MaxDirectMemorySize=3g |
Here is a list of young generation garbage collection options:
Young generation garbage collection tuning option | Flag |
Sets the tenuring threshold (threshold for collections before promotion occurs from young to tenured space). | -XX:InitialTenuringThreshold=16 |
Sets the upper tenuring threshold. | -XX:MaxTenuringThreshold=30 |
Sets the maximum object size permitted in young space. If an object is larger than the maximum size, it will be allocated to tenured space and bypass young space. | -XX:PretenureSizeThreshold=3m |
Used to promote all young objects surviving the young collection to tenured space. | -XX:+AlwaysTenure |
With this tag, objects from young space never get promoted to tenured space as long as the survivor space has sufficient room for them. | -XX:+NeverTenure |
We can indicate that we want to use thread local allocation blocks in the young space. This is enabled by default. | -XX:+UseTLAB |
Toggle this to allow the JVM to adaptively resize the TLAB (short for Thread Local Allocation Blocks) for threads. | -XX:+ResizeTLAB |
Sets the initial size of TLAB for a thread. | -XX:TLABSize=2m |
Sets the minimum allowable size of TLAB. | -XX:MinTLABSize=128k |
Here is a list of CMS tuning options:
CMS tuning option | Flag |
Indicates that you want to solely use occupancy as a criterion for starting a CMS collection operation. | -XX:+UseCMSInitiatingOccupancyOnly |
Sets the percentage CMS generation occupancy to start a CMS collection cycle. If you indicate a negative number, you are telling the JVM you want to use CMSTriggerRatio. | -XX:CMSInitiatingOccupancyFraction=70 |
Sets the percentage CMS generation occupancy that you want to initiate a CMS collection for bootstrapping collection statistics. | -XX:CMSBootstrapOccupancy=10 |
This is the percentage of MinHeapFreeRatio in CMS generation that is allocated prior to a CMS cycle starting. | -XX:CMSTriggerRatio=70 |
Sets the percentage of MinHeapFreeRatio in the CMS permanent generation that is allocated before starting a CMS collection cycle. | -XX:CMSTriggerPermRatio=90 |
This is the wait duration after a CMS collection is triggered. Use the parameter to specify how long the CMS is allowed to wait for young collection. | -XX:CMSWaitDuration=2000 |
Enables parallel remark. | -XX:+CMSParallelRemarkEnabled |
Enables parallel remark of survivor space. | -XX:+CMSParallelSurvivorRemarkEnabled |
You can use this to force young collection before the remark phase. | -XX:+CMSScavengeBeforeRemark |
Use this to prevent a scheduling remark if the Eden used is below the threshold value. | -XX:+CMSScheduleRemarkEdenSizeThreshold |
Sets the Eden occupancy percentage that you want CMS to try and schedule a remark pause. | -XX:CMSScheduleRemarkEdenPenetration=20 |
This is where you want to start sampling Eden top at least before young generation occupancy reaches 1/4 (in our sample to the right) of the size at which you want to schedule a remark. | -XX:CMSScheduleRemarkSamplingRatio=4 |
You can select variant=1 or variant=2 of verification following a remark. | -XX:CMSRemarkVerifyVariant=1 |
Elects to use the parallel algorithm for young space collection. | -XX:+UseParNewGC |
Enables the use of multiple threads for concurrent phases. | -XX:+CMSConcurrentMTEnabled |
Sets the number of parallel threads used for concurrent phases. | -XX:ConcGCThreads=2 |
Sets the number of parallel threads you want used for stop-the-world phases. | -XX:ParallelGCThreads=2 |
You can enable Incremental CMS (iCMS) mode. | -XX:+CMSIncrementalMode |
If this is not enabled, CMS will not clean permanent space. | -XX:+CMSClassUnloadingEnabled |
This allows System.gc() to trigger concurrent collection instead of a full garbage collection cycle. | -XX:+ExplicitGCInvokesConcurrent |
This allows System.gc() to trigger concurrent collection of permanent space. | ‑XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses |
iCMS mode is intended for servers with a small number of CPUs. It should not be employed on modern hardware.
Here are some miscellaneous garbage collection options:
Miscellaneous garbage collection options | Flag |
This will cause the JVM to ignore any System.gc() method invocations by an application. | -XX:+DisableExplicitGC |
This is the (soft reference) time to live in milliseconds per MB of free space in the heap. | -XX:SoftRefLRUPolicyMSPerMB=2000 |
This is the use policy used to limit the time spent in garbage collection before an OutOfMemory error is thrown. | -XX:+UseGCOverheadLimit |
This limits the proportion of time spent in garbage collection before an OutOfMemory error is thrown. This is used with GCHeapFreeLimit. | -XX:GCTimeLimit=95 |
This sets the minimum percentage of free space after a full garbage collection before an OutOfMemory error is thrown. This is used with GCTimeLimit. | -XX:GCHeapFreeLimit=5 |
Finally, here are some G1 specific options. Note that these are all supported starting with JVM 6u26:
G1 garbage collection options | Flag |
Size of the heap region. The default is 2,048 and the acceptable range is 1 MiB to 32 MiB. | -XX:G1HeapRegionSize=16m |
This is the confidence coefficient pause prediction heuristics. | -XX:G1ConfidencePercent=75 |
This determines the minimum reserve in the heap. | -XX:G1ReservePercent=5 |
This is the garbage collection time per MMU--time slice in milliseconds. | -XX:MaxGCPauseMillis=100 |
This is the pause interval time slice per MMU in milliseconds. | -XX:GCPauseIntervalMillis=200 |
MiB stands for Mebibyte, which is a multiple of bytes for digital information.