Best Garbage Collector and Configuration

This section describes the best garbage collector and configuration for our performance test program, GCPrefp99.java.

After performing enough tests with GCPerfP99.java with different garbage collectors, it's time to compare test results to see who is best garbage collector and with what GC configuration:

Collector   Configuration     New Gen    Throughput   Latency
G1          Minor GC only       200 M         512/s   3412 ms
G1          Minor GC only       400 M         551/s   2439 ms
G1          Minor GC only       800 M         565/s   2439 ms
G1          Minor GC only      1200 M         565/s   2439 ms

Collector   Configuration   Eden/From    Throughput   Latency
Concurrent  Minor GC only   100/100 M         504/s   2439 ms
Concurrent  Minor GC only   200/200 M         525/s   2439 ms
Concurrent  Minor GC only   400/400 M         538/s   2439 ms
Concurrent  Minor GC only   800/100 M         539/s   2439 ms

Collector   Configuration   Eden/From    Throughput   Latency
Parallel    Minor GC only       100 M         506/s   2439 ms
Parallel    Minor GC only       200 M         523/s   2439 ms
Parallel    Minor GC only       400 M         525/s   2439 ms

Collector   Configuration   Eden/From    Throughput   Latency
Serial      Minor GC only       100 M         493/s   2500 ms
Serial      Minor GC only       200 M         512/s   2439 ms
Serial      Minor GC only       400 M         520/s   2439 ms

Obviously, the winner is the G1 collector. And the Serial collector is the worst garbage collector.

Also note that, for GCPerfP99.java, the best GC configuration is to use a large Young generation to limit garbage collections to Minor GCs only. This is because GCPerfP99.java uses short-lived objects only.

Last update: 2018.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

 JVM Garbage Collection Logging

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

Garbage Collection Performance Test Summary

Best Garbage Collector and Configuration

 General Suggestions for Better GC Performance

 Outdated Tutorials

 References

 Full Version in PDF/EPUB