1 / 25

Dynamic Selection of Application-Specific Garbage Collectors

Dynamic Selection of Application-Specific Garbage Collectors. Sunil V. Soman Chandra Krintz University of California, Santa Barbara David F. Bacon IBM T.J. Watson Research Center. Background. VMs/managed runtimes Next generation internet computing

brede
Download Presentation

Dynamic Selection of Application-Specific Garbage Collectors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dynamic Selection of Application-Specific Garbage Collectors Sunil V. Soman Chandra Krintz University of California, Santa Barbara David F. Bacon IBM T.J. Watson Research Center

  2. Background • VMs/managed runtimes • Next generation internet computing • Automatic memory management for memory safety • High performance, multi-application servers • GC performance impacts overall performance • So GC must perform well ISMM '04

  3. GC Research • Focus on general-purpose GC • One GC for all apps • No single GC provides best performance in all cases • Across applications • Even for the same application given different memory constraints ISMM '04

  4. Motivation 410 SPECjbb2000 360 310 260 10^6/Throughput 210 160 110 1 2 3 4 5 6 7 8 9 10 11 12 Heap Size Relative to Min switch point SS _209_db SS 40 MS MS GMS GMS GSS GSS 35 CMS CMS Execution Time (sec) 30 25 20 15 1 2 3 4 5 6 7 8 9 10 11 12 Heap Size Relative to Min ISMM '04

  5. Motivation • Other researchers have reported similar results [Attanasio ’01, Fitzgerald ’00] • Spread between best & worst at least 15% • Generational not always better • Employ a VM instance built with the optimal GC • Goal of our work: employ multiple GCs in the same system and switch between them ISMM '04

  6. Framework • Implemented in the JikesRVM • Uses the Java Memory management Toolkit (JMTk) • Extended to enable multiple GC support • Can switch between diverse collectors • Easily extensible • GC System = Allocator + Collector ISMM '04

  7. Framework Implementation VM_Processor StopTheWorld StopTheWorld (Plan currentPlan;) Plan Plan {SS_Plan,MS_Plan,...} (Selected at build time) SS_Plan MS_Plan CopyMS_Plan Generational VM_Processor GenMS_Plan GenCopy_Plan • Most code is shared across GCs • 44MB vs 42MB (average across GCs) ISMM '04

  8. Framework Implementation Nursery Nursery Nursery Nursery Nursery Alloc HIGHER HIGHER HIGHER HIGHER HIGHER Mark-Sweep Mark-Sweep Mark-Sweep Mark-Sweep Mark-Sweep High Semispace High Semispace High Semispace High Semispace High Semispace Unmap Low Semispace Low Semispace Low Semispace Low Semispace Low Semispace Large Object Space Large Object Space Large Object Space Large Object Space Large Object Space GC Data Structures GC Data Structures GC Data Structures GC Data Structures GC Data Structures LOWER LOWER LOWER LOWER LOWER Immortal Immortal Immortal Immortal Immortal • Example • MS -> GSS • MS -> GMS ISMM '04

  9. Framework Implementation Nursery Nursery Alloc HIGHER HIGHER Mark-Sweep Mark-Sweep High Semispace High Semispace Low Semispace Low Semispace Large Object Space Large Object Space GC Data Structures GC Data Structures LOWER LOWER Immortal Immortal • Example • MS -> GSS • MS -> GMS No GC Do not unmap ISMM '04

  10. Framework Implementation Nursery HIGHER Mark-Sweep High Semispace Low Semispace Large Object Space GC Data Structures LOWER Immortal • Mem mapped on demand • Unused memory unmapped • Need MS & copying states • Use object header • Bit stealing • Worst-case cost = 1 GC • No need to perform GC in many cases ISMM '04

  11. Making Use of GC Switching • Dynamic switching guided by • Cross-input offline behavior • Annotation • Methodology • 2.4 GHz/1G single proc x86 (hyperthreading) • JikesRVM v2.2.0, linux kernel 2.4.18 • SpecJVM98, SpecJBB, Jolden, Javagrande • Pseudo-adaptive system ISMM '04

  12. Annotation-guided GC (AnnotGC) • Annotation • Hints about optimization opportunities • Widely used to guide compiler optimization • Different benchmarks & inputs examined offline • Cross-input results combined • Select “optimal” GC and annotate program with it • Best GC for a range of heap sizes • JVM at program load time • Switch to annotated GC • Ignore annotation if GC-Switching not avail.

  13. AnnotGC Implementation • Observations • Only 0 or 1 switch points per benchmark • Switch point relative to min heap does not vary much across inputs • Annotate min heap size & switch point • 4 byte annotation in Java class file • Encoded in a compact form • 40 MB min assumed if not specified ISMM '04

  14. AnnotGC Results 410 SPECjbb2000 _209_db 45 360 40 310 35 10^6/Throughput Execution Time (sec) 260 30 210 25 160 20 15 110 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 Heap Size Relative to Min Heap Size Relative to Min SS SS MS MS GMS GMS GSS GSS CMS CMS ISMM '04

  15. AnnotGC Results SS _209_db SS 410 SPECjbb2000 MS 45 MS GMS GMS 360 GC 40 GSS CMS CMS 310 GC Annot 35 GC Annot Execution Time (sec) 10^6/Throughput 260 30 210 25 160 20 15 110 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 Heap Size Relative to Min Heap Size Relative to Min • Degradation over best: 4% • Improvement over worst: 26% • Improvement over GenMS: 7% ISMM '04

  16. AnnotGC Results

  17. Extending GC Switching • Switch automatically • No offline profiling • Employ execution characteristics • Performance hit: lost optimization opportunity • Inlining of allocation sites • Write barriers • Solution: Aggressive specialization guarded by • Method invalidation • On-stack replacement ISMM '04

  18. Investigating Auto Switching • Exploit general performance characteristics • Best performing GCs across heap sizes & programs • Deciding when to switch • Default GC: MS • Heap size & heap residency threshold • If residency > 60%, • switch to GSS if heap size > 90MB • else use GMS • Different collectors for startup & steady-state ISMM '04

  19. Preliminary Implementation • Method invalidation - for future invocations • On-stack replacement - for currently executing methods • Deferred compilation & guarded inlining [Fink’04] • Unconditional OsrPoints • Our extension • OsrInfoPoints for state info • Without inserting checks in application code ISMM '04

  20. AutoSwitch Results • Improvement over worst: 17% (Annot: 26%) • Degradation over best: 15% (Annot: 4%) • Overhead • OSR - negligible • Recompilation - depends on where switch occurs • Lost optimization opportunities • all variables live at every GC point • OsrInfoPoints are “pinned” down • DCE, load/store elim, code motion, reg allocation ISMM '04

  21. Related Work • Application-specific GC studies • Profile-direction GC selection [Fitzgerald’00] • Comparison of GCs [Attanasio’01] • Comparing gen mark-sweep & copying [Zorn’90] • Switching/swapping • Coupling compaction with copying [Sansom’92] • Hot-swapping mark-sweep/mark-compact [Printezis’01] • BEA Weblogic JRockit [BEA Workshop’03] ISMM '04

  22. Conclusion • Choice of best GC is app-dependent • Novel framework • Switch between diverse collectors • Enables annotation driven & automatic switching • Significantly reduce impact of choosing the "wrong" collector • AnnotGC: 26%, degradation: 4%, GMS: 7% • Enabled by aggressive specialization ISMM '04

  23. Future Work • Improving AutoSwitch • Improved OSR • Cuts AutoSwitch overhead by half • Paper available upon request • Better heuristics for automatic switching • Decide when to switch & which GC to switch to • High-performance application-specific VMs • Guided by available resources • Application characteristics • Self-modifying ISMM '04

  24. App-specific Garbage Collectors Front Loaders Rear Loaders Recyclers Side Loaders All products are trademarks of Heil Environmental Industries, Ltd. 2002-2003

  25. Extra slides ISMM '04

More Related