b53ad88bb035954dbcdd387347c74a51.ppt
- Количество слайдов: 45
Hippocratic Garbage Collection Matthew Hertz, Yi Feng, & Emery Berger Department of Computer Science University of Massachusetts UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
Dude, where’s my performance? n Sun Hot. Spot JDK 1. 4. 1, Java Beans benchmark UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 2
Ever-Steeper Memory Hierarchy n Higher = smaller, faster, closer to CPU n A real desktop machine (mine) registers 8 integer, 8 floating-point; 1 -cycle latency L 1 cache 8 K data & instructions; 2 -cycle latency L 2 cache 512 K; 7 -cycle latency RAM 1 GB; 100 cycle latency Disk 40 GB; 38, 000 cycle latency (!) UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 3
Program Throughput: Ideal vs. Real UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 4
GC Pause Time From 55 milliseconds to 30 seconds!. . Can we avoid this? UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 5
Memory Prices Over Time “Soon it will be free…” UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 6
Memory Prices: Inflection Point UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 7
Memory Not So Free “Buy more RAM” = “Ferraris for Everyone” Servers: buy 4 GB, get 1 CPU free! n Sun E 10000: 4 GB extra = $75, 000! n Fast RAM n Cosmic rays… Desktops: most 256 MB n 1 GB = 50% more $ n Laptops = 70%, if possible 4 GB Sun RAM = ½ Ferrari Modena UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 8
Fast DDR 2 modules today: $500/GB UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 9
Outline n n n Motivation GC Paging Behavior Hippocratic Garbage Collection n n Cooperation Bookmarking Results Future Work UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 10
What’s really going on here? UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 11
GC Performance While Paging RAM Hard Disk n GC: Touch evicted page UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 12
GC Performance While Paging RAM Hard Disk n VM: brings page in-core UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 13
GC Performance While Paging RAM Hard Disk n VM: evicts different page (LRU) UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 14
GC Performance While Paging RAM Hard Disk n GC: Touches page on disk UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 15
GC Performance While Paging RAM Hard Disk n VM: Evicts another page…and so on… UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 16
Oblivious Memory Management n Garbage collection: VM-oblivious n n n Cannot adjust to changing memory pressure Touches non-resident pages Virtual memory: GC-oblivious n Likely to evict pages needed by GC UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 17
Outline n n n Motivation GC Paging Behavior Hippocratic Garbage Collection n n Cooperation Bookmarking Results Future Work UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 18
Our Inspiration As to diseases, make a habit of two things: to help, or at least, to do no harm. Hippocrates UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 19
Hippocratic Garbage Collection Garbage collector Virtual memory manager page eviction notification Evacuates pages Selects victim pages n n victim page(s) Page replacement Goal: GC triggers no additional paging Key ideas: n n n Minimize space consumption Exploit page information from VM n Residency, eviction notifications Avoid touching evicted pages UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 20
HC Collector Overview n Generational n n n Focused activity in nursery: improves locality Mark-sweep (w/o pressure) Compaction n n Shrink nursery Segregated size classes n n ð Eliminates fragmentation Reduces memory pressure Essentially page-oriented Gen. MS + compaction UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 21
Segregated Size Classes n Mark objects UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 22
Segregated Size Classes n Copy into empty spaces UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 23
Cooperative Collection n GC and VM communication n Before-paging callback Per-page eviction negotiation Modify collector n n Manage heap memory at page granularity GC on page eviction notification When possible, return empty pages Otherwise, process pages before eviction: “bookmarking” UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 24
Bookmarking RAM Hard Disk Process pages before they are evicted… UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 25
Bookmarking RAM Hard Disk …by “bookmarking” target objects UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 26
Bookmarking RAM Hard Disk then allow page eviction UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 27
Collection with Bookmarking RAM Hard Disk process objects as normal except… UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 28
Collection with Bookmarking RAM Hard Disk …ignore references to evicted pages UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 29
Collection with Bookmarking RAM Hard Disk bookmarks remember references from disk UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 30
Collection with Bookmarking RAM Hard Disk Result: no paging! UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 31
Bookmarking Details n Cheap summary of connectivity n n One bit per object: stolen from object header One word per page: count of pages that hold bookmarks on this page n n Clear bookmarks when zero Invoke VM-oblivious collection only when heap is exhausted n n Common case for all other collectors! In practice: hasn’t happened yet UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 32
Outline n n n Motivation GC Paging Behavior Hippocratic Garbage Collection n n Cooperation Bookmarking Results Future Work UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 33
Methodology n n Jikes RVM, MMTk, extended Linux kernel “OPT + reset” n n Benchmarks: n n n Opt-compile first, full collection, second timing run SPECjvm 98, Da. Capo suite (ipsixql, jython) SPECjbb variant (pseudojbb) Signalmem for memory pressure n n Dynamic (30 MB, then 60 MB) Static (40% of heap available) UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 34
Execution time: No Memory Pressure n Generally runs in smaller heaps, fast as Gen. MS UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 35
Execution Time: No Memory Pressure – pseudo. JBB n Copy. MS, etc. at least 6%-89% slower UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 36
Execution Time: Dynamic Memory Pressure n Startup process: 30 MB, then 60 MB more UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 37
Pause Time: Dynamic Memory Pressure n Startup process: 30 MB, then 60 MB more UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 38
Execution Time: Constant Memory Pressure n Memory sufficient to hold 40% of heap UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 39
Pause Times: Constant Memory Pressure n Memory sufficient to hold 40% of heap UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 40
Future Work n Different eviction strategies n n n Richer summaries Shrink heap vs. evict pages; grow heap n n n Exploit type info, fewer pointers Requires more VM info Static analyses Combine with automatic heap sizing [Yang et al. , ISMM 04] UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 41
Conclusion n Hippocratic Garbage Collection n n Cooperates with VM Competitive when not paging n n n Performs up to 13% faster with small heaps As fast as Gen. MS for larger heaps Greatly improves performance when paging n n Throughput up to 3 x greater Average pause times up to 30 x smaller than Copy. MS, 70 x smaller than Gen. MS UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 42
Backup Slides UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 43
Some Related Work n Compaction: reduce working set n n n Linearize lists [Bobrow & Murphy] Semispace collection [Baker, Fenichel & Yochelson] Reduce frequency of whole-heap collection n Ephemeral [Moon] & generational collectors [Lieberman & Hewett, Ungar, Appel] n Cooperation n n Shrink heap [Alonso & Appel] Give up empty pages [Cooper, Nettles et al. ] UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 44
Tracking Page Value unprotected n protected Maintain histogram per page position n Provides value to application of n pages (for any n) UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 45
b53ad88bb035954dbcdd387347c74a51.ppt