-XX:SurvivorRatio=<n> should be used when you want to explicitly size survivor
spaces to manipulate object aging with the concurrent garbage collector, or to
manipulate object aging with the throughput garbage collector when adaptive sizing
is disabled using the command line option -XX:-UseAdaptiveSizePolicy.
So the -XX:SurvivorRatio is ignored unless you use -XX:-UseAdaptiveSizePolicy.
you need to compute Allocation Rate (see Advanced JVM Tuning) to determine the size of the your Eden Space.
also, Total Young Generation-Xmn should be from 1x to 1.5x of OldGen space occupancy after a full GC (as noted in Java Performance).
Sizing the Survivor Spaces:
you need to be watching Promotion Rate (again see Advanced JVM Tuning) so you do not make the FullGC too frequent by decreasing the Survivor/Eden space,
-XX:+PrintTenuringDistribution is essential, this will show you the Tenuring Ages,
-XX:SurvivorRatio=, -XX:TargetSurvivorRatio= and -XXMaxTenuringThreshold= will be needed to actually tune the Survivor Sizes.
See the Request for documentation of -XX:+PrintTenuringDistribution output for more info.
Pprovides CPU usage and elapsed time information. The value to the
right of user is the CPU time used by the garbage collection executing
instructions outside the operating system. In this example, the
garbage collector used 0.06 seconds of user CPU time. The value to the
right of sys is the CPU time used by the operating system on behalf of
the garbage collector. In this example, the garbage collector did not
use any CPU time executing operating system instructions on behalf of
the garbage collection. The value to the right of real is the elapsed
wall clock time in seconds of the garbage collection. In this example,
it took 0.06 seconds to complete the garbage collection.
https://www.amazon.com/Java-Performance-Companion-Charlie-Hu...
https://www.amazon.com/Java-Performance-Definitive-Guide-Get...
There is the BOOK about java performance tuning:
So the
-XX:SurvivorRatio
is ignored unless you use-XX:-UseAdaptiveSizePolicy
.Sizing Eden Space:
-Xmn
should be from 1x to 1.5x of OldGen space occupancy after a full GC (as noted in Java Performance).Sizing the Survivor Spaces:
-XX:+PrintTenuringDistribution
is essential, this will show you the Tenuring Ages,-XX:SurvivorRatio=
,-XX:TargetSurvivorRatio=
and-XXMaxTenuringThreshold=
will be needed to actually tune the Survivor Sizes.There are multiple factors:
Java Performance by Hunt et al has some good material on optimizing Java GC for throughput and latency.
If you have a practical problem to solve, using a memory profiler on your program is often a good first step.
PrintGCDetails - this option could be helpful. It prins information about every garbage collection.
Java Performance - good book, could be found in digital version. Contains a great article about measuring GC's impact.