Oracle proposes to use G1 as the default Garbage Collector for Java 9
Oracle is considering including JEP 248 in Java 9's JEP list, that is, using G1 as the default Garbage Collector in server configuration. This decision has sparked some debate in the Java Community, and many people think that the concurrent tag and scan CMS) Collector may be more appropriate.
If this decision is put into practice, G1 will replace the parallel garbage collector as the default option for server configuration. As described in Oracle's memory management White Paper, The parallel garbage collector was designed to run through a Stop-The-WorldSTW That often happens but may take a long time) maximize application throughput with interruptions. The parallel Garbage Collector minimizes the total computing time consumed. In the long run, it is less destructive, so it can provide better overall performance. This collector is suitable for applications with low response time requirements, such as batch processing.
On the other hand, as the former G1 Performance Manager Monica Beckwith previously stated on InfoQ, Garbage FirstG1 was designed to minimize the STW interruption time at a higher computing cost. G1 is more suitable for low-latency applications, such as Web servers, which also reflects Stefan Johansson's motivation in JEP:
In general, limiting GC interrupt times is more important than maximizing throughput. For most users, switching to a garbage collector with a short interruption time, such as G1, is better than a throughput-oriented collector, such as a parallel garbage collector.
There is a controversy here. HotSpot introduced CMS for the same purpose. In fact, according to Oracle's description, CMS "is designed for applications that want to shorten the garbage collection interruption time, and applications that can share processor resources with the garbage collector at runtime ". Many public benchmark tests show that in applications with relatively small memory usage, the performance of CMS is often better than that of G1, which is consistent with the description of G1 in Oracle, that is, G1 is applicable to server applications with a heap size of 6 GB or above.
In a recent session, Performance Expert Kirk Pepperdine pointed out that Google has contributed a number of improvements to CMS, but they have never appeared in hot spot. He added that although G1 may be a better choice in the long run, the Oracle design scheme has deprived the community of the power to get a better experience from CMS.
Oracle Proposes G1 as the Default Garbage Collector for Java 9