Profile Image
vishnupriya

What is JVM startup parameter: -XX:TargetSurvivorRatio?

What is JVM startup parameter: -XX:TargetSurvivorRatio? 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-targetsurvivorratio

  • x-targetsurvivorratio

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can set the desired percentage of survivor space used after scavenge with:

 

-XX:TargetSurvivorRatio=percent , where percent is the desired value in %.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

This will instruct JVM to use 20% of survivor space used after scavenge:

 

-XX:TargetSurvivorRatio=20

 

Description:

 

This flag sets the maximum survivor space usage percentage. When this limit is reached, all remaining live objects will be promoted to Tenured generation regardless of their age.

 

The first condition of live object tenuring (promoted from survivor space into Tenured generation). When a live object has reached the tenuring threshold age, it will be promoted into Tenured generation.

 

However, there another condition that triggers object tenuring. When the survivor space usage has reached target ratio defined by another option called "-XX:TargetSurvivorRatio", remaining live objects, regardless of their age, will be promoted into Tenured generation. This case is also called premature tenuring (or premature promotion).

 

The Serial collector, uses "-XX:TargetSurvivorRatio=50" as the default, which says, I need to keep my survivor space usage below 50%. This seems to be a big waste of heap memory.

 

Default Value:

 

Default is 50%.

 

Errors:

 

The value should be between 0 and 100.

 

Arguments related:

 

UseG1GC, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC

 

Related Posts:

 

Got something else on mind? Post Your Question

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

  • xx-targetsurvivorratio

  • x-targetsurvivorratio

  • JVM startup parameter