ABSTRACT
Garbage-First is among today's most widely used garbage collectors. It is used in the HotSpot and OpenJDK virtual machines, and shares algorithmic foundations with three other important contemporary collectors: Shenandoah, C4, and ZGC. However, the design of the core algorithms and the performance tradeoffs they manifest have not been carefully analyzed in the literature. In this work, we deconstruct the G1 algorithm and re-implement it from first principles. We retrospectively develop a concurrent, region-based evacuating collector, CRE, which captures the principal design elements shared by G1, Shenandoah, C4, and ZGC. We then evaluate the impact of each of the major elements of G1 on performance, including pause time, remembered set footprint and barrier overheads. We find that G1's concurrent marking and generational collection reduces the 95-percentile GC pauses by 64% and 93% respectively. We find that the space overhead of G1's remembered sets is very low, typically under 1%. We also independently measure the barriers used by G1 and find that they have an overhead of around 12% with respect to total performance. This analysis gives users and collector designers insights into the garbage-first collector and the other fixed-size region-based concurrent evacuating collectors, which we hope will lead to better use of the collectors and provoke future improvements.
- Bowen Alpern, Steve Augart, Stephen M Blackburn, Maria Butrico, Anthony Cocchi, Perry Cheng, Julian Dolby, Stephen Fink, David Grove, Michael Hind, et al. 2005. The Jikes research virtual machine project: building an open-source research community. IBM Systems Journal 44, 2 (2005), 399--417.Google ScholarDigital Library
- Stephen M Blackburn, Perry Cheng, and Kathryn S McKinley. 2004. Oil and water? High performance garbage collection in Java with MMTk. In Software Engineering, 2004. ICSE 2004. Proceedings. 26th International Conference on. IEEE, 137--146.Google ScholarCross Ref
- Stephen M. Blackburn, Robin Garner, Chris Hoffmann, Asjad M. Khang, Kathryn S. McKinley, Rotem Bentzur, Amer Diwan, Daniel Feinberg, Daniel Frampton, Samuel Z. Guyer, Martin Hirzel, Antony Hosking, Maria Jump, Han Lee, J. Eliot B. Moss, Aashish Phansalkar, Darko Stefanović, Thomas VanDrunen, Daniel von Dincklage, and Ben Wiedermann. 2006. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. SIGPLAN Not. 41, 10 (Oct. 2006), 169--190. Google ScholarDigital Library
- Stephen M. Blackburn, Martin Hirzel, Robin Garner, and Darko Stefanović. [n. d.]. pjbb2005: The pseudoJBB benchmark. http://users.cecs.anu.edu.au/~steveb/research/research-infrastructure/pjbb2005Google Scholar
- Stephen M. Blackburn and Antony L. Hosking. 2004. Barriers: friend or foe?. In Proceedings of the 4th International Symposium on Memory Management, ISMM 2004, Vancouver, BC, Canada, October 24 -- 25, 2004. ACM, 143--151. Google ScholarDigital Library
- Stephen M Blackburn and Kathryn S McKinley. 2008. Immix: a mark-region garbage collector with space efficiency, fast collection, and mutator performance. In ACM SIGPLAN Notices, Vol. 43. ACM, 22--32.Google ScholarDigital Library
- Rodney A Brooks. 1984. Trading data space for reduced time and code space in real-time garbage collection on stock hardware. In Proceedings of the 1984 ACM Symposium on LISP and functional programming. ACM, 256--262.Google ScholarDigital Library
- C. J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. 13, 11 (Nov. 1970), 677--678.Google Scholar
- Iris Clark, Roman Kennke, and Aleksey Shipilev. 2015. OpenJDKWiki: Shenandoah GC. https://wiki.openjdk.java.net/display/Shenandoah#Main-PerformanceAnalysis Accessed February 2020.Google Scholar
- Cliff Click, Gil Tene, and Michael Wolf. 2005. The Pauseless GC Algorithm. In Proceedings of the 1st ACM/USENIX International Conference on Virtual Execution Environments (VEE '05). ACM, New York, NY, USA, 46--56. Google ScholarDigital Library
- W. D. Clinger and L. T. Hansen. 1997. Generational Garbage Collection and the Radioactive Decay Model. Las Vegas, NV, 73--85.Google Scholar
- David Detlefs, Christine Flood, Steve Heller, and Tony Printezis. 2004. Garbage-first garbage collection. In Proceedings of the 4th international symposium on Memory management. ACM, 37--48.Google ScholarDigital Library
- Robert T. Dimpsey, Rajiv Arora, and Kean Kuiper. 2000. Java server performance: A case study of building efficient, scalable JVMs. IBM Systems Journal 39, 1 (2000), 151--174. Google ScholarDigital Library
- Robert R Fenichel and Jerome C Yochelson. 1969. A LISP garbage-collector for virtual-memory computer systems. Commun. ACM 12, 11 (1969), 611--612.Google ScholarDigital Library
- Christine H Flood, Roman Kennke, Andrew Dinn, Andrew Haley, and Roland Westrelin. 2016. Shenandoah: An open-source concurrent compacting garbage collector for openjdk. In Proceedings of the 13th International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools. ACM, 13.Google ScholarDigital Library
- Richard L. Hudson and J. Eliot B. Moss. 1992. Incremental Collection of Mature Objects. In Proceedings of the International Workshop on Memory Management (Lecture Notes on Computer Science). Springer-Verlag, 388--403.Google ScholarCross Ref
- Roman Kennke. 2019. Shenandoah GC in JDK 13, Part 1: Load reference barriers. https://developers.redhat.com/blog/2019/06/27/shenandoah-gc-in-jdk-13-part-1-load-reference-barriers/Google Scholar
- Roman Kennke. 2019. Shenandoah GC in JDK 13, Part 2: Eliminating the forward pointer word. https://developers.redhat.com/blog/2019/06/28/shenandoah-gc-in-jdk-13-part-2-eliminating-the-forward-pointer-word/Google Scholar
- Roman Kennke. 2019. Shenandoah GC in JDK 13, Part 3: Architectures and operating systems. https://developers.redhat.com/blog/2019/07/01/shenandoah-gc-in-jdk-13-part-3-architectures-and-operating-systems/Google Scholar
- Roman Kennke. 2020. Shenandoah 2.0. In FOSDEM'20, Brussels, February 1--2, 2020. https://fosdem.org/2020/schedule/event/shenandoah/Google Scholar
- Bernard Lang and Francis Dupont. 1987. Incremental incrementally compacting garbage collection. In Proceedings of the Symposium on Interpreters and Interpretive Techniques, 1987, St. Paul, Minnesota, USA, June 24 -- 26, 1987, Richard L. Wexelblat (Ed.). ACM, 253--263. Google ScholarDigital Library
- Per Liden and Stefan Karlsson. 2018. ZGC: A Scalable Low-Latency Garbage Collector. http://openjdk.java.net/jeps/333Google Scholar
- H. Lieberman and C. E. Hewitt. 1983. A Real Time Garbage Collector Based on the Lifetimes of Objects. 26, 6 (1983), 419--429.Google Scholar
- John McCarthy. 1960. Recursive functions of symbolic expressions and their computation by machine, Part I. Commun. ACM 3, 4 (1960), 184--195.Google ScholarDigital Library
- Khanh Nguyen, Lu Fang, Guoqing Xu, and Brian Demsky. 2015. Speculative region-based memory management for big data systems. In Proceedings of the 8th Workshop on Programming Languages and Operating Systems. ACM, 27--32.Google ScholarDigital Library
- OpenJDK. 2018 (accessed Feb 15, 2020). heapRegion.cpp. https://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/hotspot/share/gc/g1/heapRegion.cpp#l63Google Scholar
- OpenJDK. 2018 (accessed March 4, 2019). g1BarrierSetC1.cpp. https://hg.openjdk.java.net/jdk/jdk11/file/tip/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp#l149Google Scholar
- OpenJDK. 2018 (accessed March 4, 2019). g1BarrierSetC2.cpp. https://hg.openjdk.java.net/jdk/jdk11/file/tip/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp#l452Google Scholar
- OpenJDK. 2018 (accessed March 4, 2019). g1BarrierSet.cpp. https://hg.openjdk.java.net/jdk/jdk11/file/tip/src/hotspot/share/gc/g1/g1BarrierSet.cpp#l99Google Scholar
- OpenJDK. 2018 (accessed March 9, 2019). g1BarrierSet.inline.hpp. https://hg.openjdk.java.net/jdk/jdk11/file/tip/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp#l36Google Scholar
- OpenJDK. 2018 (accessed Nov 27, 2019). g1Policy.cpp. https://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/hotspot/share/gc/g1/g1Policy.cpp#l213Google Scholar
- Rifat Shahriyar, Stephen Michael Blackburn, Xi Yang, and Kathryn S McKinley. 2013. Taking off the gloves with reference counting Immix. ACM SIGPLAN Notices 48, 10 (2013), 93--110.Google ScholarDigital Library
- Standard Performance Evaluation Corporation 1999. SPECjvm98, Release 1.03. Standard Performance Evaluation Corporation. http://www.spec.org/jvm98Google Scholar
- Darko Stefanović, Kathryn S. McKinley, and J. Eliot B. Moss. 1999. Age-Based Garbage Collection. Denver, CO.Google Scholar
- Gil Tene, Balaji Iyengar, and Michael Wolf. 2011. C4: The continuously concurrent compacting collector. ACM SIGPLAN Notices 46, 11 (2011), 79--88.Google ScholarDigital Library
- D. M. Ungar. 1984. Generation Scavenging: A Non-Disruptive High Performance Storage Reclamation Algorithm. In ACM Software Engineering Symposium on Practical Software Development Environments. 157--167.Google ScholarDigital Library
- P. R. Wilson and T. G. Moher. 1989. A "Card-marking" Scheme for Controlling Intergenerational References in Generation-based Garbage Collection on Stock Hardware. 87--92. Google ScholarDigital Library
- Xi Yang, Stephen M Blackburn, Daniel Frampton, and Antony L Hosking. 2012. Barriers reconsidered, friendlier still!. In ACM SIGPLAN Notices, Vol. 47. ACM, 37--48.Google ScholarDigital Library
- Xi Yang, Stephen M. Blackburn, Daniel Frampton, and Antony L. Hosking. 2012. Barriers reconsidered, friendlier still!. In Proceedings of the 11th International Symposium on Memory Management, ISMM 2012, Beijng, China, June 15 -- 16, 2012. ACM.Google ScholarDigital Library
- Taiichi Yuasa. 1990. Real-time garbage collection on general-purpose machines. Journal of Systems and Software 11, 3 (1990), 181--198.Google ScholarDigital Library
Index Terms
- Deconstructing the garbage-first collector
Recommendations
Implementing an on-the-fly garbage collector for Java
ISMM '00: Proceedings of the 2nd international symposium on Memory managementJava uses garbage collection (GC) for the automatic reclamation of computer memory no longer required by a running application. GC implementations for Java Virtual Machines (JVM) are typically designed for single processor machines, and do not ...
An on-the-fly mark and sweep garbage collector based on sliding views
Special Issue: Proceedings of the OOPSLA '03 conferenceWith concurrent and garbage collected languages like Java and C# becoming popular, the need for a suitable non-intrusive, efficient, and concurrent multiprocessor garbage collector has become acute. We propose a novel mark and sweep on-the-fly algorithm ...
Implementing an on-the-fly garbage collector for Java
Java uses garbage collection (GC) for the automatic reclamation of computer memory no longer required by a running application. GC implementations for Java Virtual Machines (JVM) are typically designed for single processor machines, and do not ...
Comments