The garbage collection (GC) algorithms in Java provide opportunities for performance optimizations for your application. Java provides the following GC algorithms:
-XX:+UseSerialGC to use this
algorithm.-XX:+UseParNewGC to use
this algorithm.-XX:+UseConcMarkSweepGC to use this
algorithm.-XX:+UseG1GC to use this
algorithm.Consider testing your application with different GC algorithms to determine their effects on performance.
Set the following flags in Java to log the GC algorithm's behavior for later analysis:
-verbose:gc
-Xloggc:<filename>
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGCApplicationStoppedTime
For more information, see the Java Garbage Collection Tuning document or the Java Garbage Collection links.