Profile Image
vishnupriya

What is JVM startup parameter: -XX:MaxTenuringThreshold?

What is JVM startup parameter: -XX:MaxTenuringThreshold? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-maxtenuringthreshold

  • x-maxtenuringthreshold

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can set the maximum tenuring threshold for use in adaptive GC sizing with the following command

 

-XX:MaxTenuringThreshold=value.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

The following example shows how to set the maximum tenuring threshold to 10:

 

-XX:MaxTenuringThreshold=10

 

Description:

 

When tuning the Java garbage collector (GC), so called 'survivor spaces' can be configured to "age" new objects. This can reduce fragmentation in the old space of the heap, particularly when using the Concurrent Mark Sweep (CMS) collector.

 

The Java command line parameter -XX:MaxTenuringThreshold specifies for how many minor GC cycles an object will stay in the survivor spaces until it finally gets tenured into the old space.

 

Many tuning documents and forum discussions mention a maximum value of 31 for this parameter. However, since version 1.5.0_06, and in all versions of Java 6, the maximum value has been reduced to 15.

 

If a value greater than 15 is set, this now specifies that objects should never tenure. This is very bad, as the survivor space will be consumed indefinitely by old objects. This in turn leads to instant promotion of all newly created objects, rapidly leading to heap fragmentation.

 

A fragmented heap cannot accommodate as many objects as a compacted heap. Hence the CMS GC might have to be abandoned in favour of a full 'stop-the-world' GC to defragment the heap. The practical impact is likely to be an increased number of unnecessary application pauses.

 

The largest value is 15. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector.

 

Default Value:

 

Default is 15.

 

Errors:

 

The value should be between 0 and 15.

 

Related Posts:

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-maxtenuringthreshold

  • x-maxtenuringthreshold

  • JVM startup parameter