G1GC vs. Concurrent Mark and Sweep Java Garbage Collector
June 24, 2013 6 Comments
Lately, inquiries about the G1GC Java Garbage Collector have been on the rise (e.g., see this search-lucene.com graph). So last Friday we took one of our Search Analytics servers running HBase RegionServer and a semi-recent version of Oracle Java (build 1.7.0_07-b10) and switched it to G1 (-XX:+UseG1GC and no other G1-specific parameters). Below are some before and after graphs taken from SPM, which is what we use to monitor all our servers, of course. Click on them for full size.
Can you tell what time we made the switch? If you cannot tell, have a look at the graph below for a more obvious and more dramatic before and after.
Bases on the above graphs, we can see that, at least in this particular workload, G1GC does more collections, but they are smaller and thus take less time. We’ll keep monitoring JVMs using G1, and if they continue to perform well, we’ll switch to them wherever applicable. Here is one more look at the situation:
On this SPM Dashboard you should compare the panel/graph on top (using CMS) with the panel/graph directly below it (G1).
In short, we are seeing some more GC work done on the Young generation with G1, but a lot less work being done with the Old generation and thus we see far fewer long pauses than with CMS garbage collector!
If performance and/or monitoring excites you, come join us! If you want to learn more about Java GC and live in or near New York, register for Living with Garbage by Gregg Donovan, a Senior Software Engineer at Etsy.
Please tweet this post about G1GC.
Have you tried G1 Garbage Collector lately? How did it work for you?