skip to main content
10.1145/3381052.3381320acmconferencesArticle/Chapter ViewAbstractPublication PagesveeConference Proceedingsconference-collections
research-article

Deconstructing the garbage-first collector

Published:17 March 2020Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarCross RefCross Ref
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. 13, 11 (Nov. 1970), 677--678.Google ScholarGoogle Scholar
  9. Iris Clark, Roman Kennke, and Aleksey Shipilev. 2015. OpenJDKWiki: Shenandoah GC. https://wiki.openjdk.java.net/display/Shenandoah#Main-PerformanceAnalysis Accessed February 2020.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. W. D. Clinger and L. T. Hansen. 1997. Generational Garbage Collection and the Radioactive Decay Model. Las Vegas, NV, 73--85.Google ScholarGoogle Scholar
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarCross RefCross Ref
  17. 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 ScholarGoogle Scholar
  18. 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 ScholarGoogle Scholar
  19. 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 ScholarGoogle Scholar
  20. Roman Kennke. 2020. Shenandoah 2.0. In FOSDEM'20, Brussels, February 1--2, 2020. https://fosdem.org/2020/schedule/event/shenandoah/Google ScholarGoogle Scholar
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. Per Liden and Stefan Karlsson. 2018. ZGC: A Scalable Low-Latency Garbage Collector. http://openjdk.java.net/jeps/333Google ScholarGoogle Scholar
  23. H. Lieberman and C. E. Hewitt. 1983. A Real Time Garbage Collector Based on the Lifetimes of Objects. 26, 6 (1983), 419--429.Google ScholarGoogle Scholar
  24. John McCarthy. 1960. Recursive functions of symbolic expressions and their computation by machine, Part I. Commun. ACM 3, 4 (1960), 184--195.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle Scholar
  27. 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 ScholarGoogle Scholar
  28. 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 ScholarGoogle Scholar
  29. 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 ScholarGoogle Scholar
  30. 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 ScholarGoogle Scholar
  31. 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 ScholarGoogle Scholar
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. Standard Performance Evaluation Corporation 1999. SPECjvm98, Release 1.03. Standard Performance Evaluation Corporation. http://www.spec.org/jvm98Google ScholarGoogle Scholar
  34. Darko Stefanović, Kathryn S. McKinley, and J. Eliot B. Moss. 1999. Age-Based Garbage Collection. Denver, CO.Google ScholarGoogle Scholar
  35. Gil Tene, Balaji Iyengar, and Michael Wolf. 2011. C4: The continuously concurrent compacting collector. ACM SIGPLAN Notices 46, 11 (2011), 79--88.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. Taiichi Yuasa. 1990. Real-time garbage collection on general-purpose machines. Journal of Systems and Software 11, 3 (1990), 181--198.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Deconstructing the garbage-first collector

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        VEE '20: Proceedings of the 16th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments
        March 2020
        204 pages
        ISBN:9781450375542
        DOI:10.1145/3381052

        Copyright © 2020 Owner/Author

        Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 17 March 2020

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate80of235submissions,34%

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader