Hippocratic Garbage Collection

Document Sample
Hippocratic Garbage Collection Powered By Docstoc
					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?




   Sun HotSpot JDK 1.4.1, Java Beans benchmark
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   2
Ever-Steeper Memory Hierarchy
    Higher = smaller, faster, closer to CPU
         A real desktop machine (mine)

               registers         8 integer, 8 floating-point; 1-cycle latency

               L1 cache          8K data & instructions; 2-cycle latency

               L2 cache          512K; 7-cycle latency



                  RAM            1GB; 100 cycle latency



                  Disk           40 GB; 38,000,000 cycle latency (!)



    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science       3
  Program Throughput: Ideal vs. Real
                                           BB
                Execution Tim e for pseudoJ with 60MB Heap
                          900
                                  Ideal
                          800     GenCopy
Execut ion Tim e (in s)




                                  GenMS
                          700

                          600

                          500

                          400

                          300

                          200

                          100

                            0
                            492                     113                      103                  93
                                                  Available Mem ory (in MB)


                          UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science        4
GC Pause Time
                        Max Garbage Collection Pause for pseudoJBB
                        32.5
                         30
                        27.5
 Avg. GC Pause (in s)




                         25
                        22.5
                         20
                        17.5                                                     GenCopy
                                                                                 GenMS
                         15
                        12.5
                         10
                         7.5
                          5
                         2.5
                           0
                           492       113            103                93
                                  Available Mem ory (in MB)

From 55 milliseconds to 30 seconds!..Can we avoid this?
         UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science             5
Memory Prices Over Time
                                     RAM Prices Over Time
                                          (1977 dollars)


                 $10,000.00



                  $1,000.00


                                                                                2K
                   $100.00
                                                                                8K
Dollars per GB




                                                                                32K
                    $10.00                                                      128K
                                       conventional DRAM
                                                                                512K
                                                                                2M
                     $1.00
                                                                                8M


                     $0.10



                     $0.01
                              1977
                              1978
                              1979
                              1980
                              1981
                              1982
                              1983
                              1984
                              1985
                              1986
                              1987
                              1988
                              1989
                              1990
                              1991
                              1992
                              1993
                              1994
                              1995
                              1996
                              1997
                              1998
                              1999
                              2000
                              2001
                              2002
                              2003
                              2004
                              2005
                                                Year



                              “Soon it will be free…”
             UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science     6
Memory Prices: Inflection Point
                                     RAM Prices Over Time
                                          (1977 dollars)


                 $10,000.00



                  $1,000.00
                                                                                2K
                                                                                8K
                   $100.00
                                                                                32K
Dollars per GB




                                                                                128K
                    $10.00                                       SDRAM,         512K
                                       conventional DRAM         RDRAM,
                                                                 DDR,
                                                                                2M
                                                                 Chipkill       8M
                     $1.00
                                                                                512M
                                                                                1G
                     $0.10



                     $0.01
                              1977
                              1978
                              1979
                              1980
                              1981
                              1982
                              1983
                              1984
                              1985
                              1986
                              1987
                              1988
                              1989
                              1990
                              1991
                              1992
                              1993
                              1994
                              1995
                              1996
                              1997
                              1998
                              1999
                              2000
                              2001
                              2002
                              2003
                              2004
                              2005
                                                Year




             UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science     7
Memory Not So Free
“Buy more RAM” = “Ferraris for Everyone”
Servers: buy 4GB,
   get 1 CPU free!
 Sun E10000:
    4GB extra =
   $75,000!
 Fast RAM

 Cosmic rays…




Desktops: most 256MB                           4GB Sun RAM =
 1GB = 50% more $                               ½ Ferrari Modena
 Laptops = 70%, if possible

  UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   8
Fast DDR2 modules today: $500/GB




 UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   9
Outline

   Motivation
   GC Paging Behavior
   Hippocratic Garbage Collection
         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

    GC: Touch evicted page
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science         12
GC Performance While Paging




                                                                            RAM




                                                                Hard Disk

    VM: brings page in-core
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science         13
GC Performance While Paging




                                                                            RAM




                                                                Hard Disk

    VM: evicts different page (LRU)
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science         14
GC Performance While Paging




                                                                            RAM




                                                                Hard Disk

    GC: Touches page on disk
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science         15
GC Performance While Paging




                                                                            RAM




                                                                Hard Disk

    VM: Evicts another page…and so on…
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science         16
Oblivious Memory Management

   Garbage collection: VM-oblivious
         Cannot adjust to changing memory pressure
         Touches non-resident pages
   Virtual memory: GC-oblivious
         Likely to evict pages needed by GC




    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   17
Outline
    Motivation
    GC Paging Behavior
    Hippocratic Garbage Collection
         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                                        Page replacement
Selects victim pages           victim page(s)




   Goal: GC triggers no additional paging
   Key ideas:
         Minimize space consumption
         Exploit page information from VM
            Residency, eviction notifications

         Avoid touching evicted pages
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   20
HC Collector Overview
   Generational
         Focused activity in nursery: improves locality
   Mark-sweep (w/o pressure)
   Compaction
         Shrink nursery
         Segregated size classes
              Eliminates fragmentation
              Reduces memory pressure


   Essentially page-oriented GenMS + compaction

    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   21
Segregated Size Classes




    Mark objects
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   22
Segregated Size Classes




    Copy into empty spaces
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   23
Cooperative Collection
   GC and VM communication
         Before-paging callback
         Per-page eviction negotiation

   Modify collector
         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
   Cheap summary of connectivity
         One bit per object: stolen from object header
         One word per page: count of pages that hold
          bookmarks on this page
              Clear bookmarks when zero
   Invoke VM-oblivious collection only when
    heap is exhausted
         Common case for all other collectors!
         In practice: hasn’t happened yet

    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   32
Outline
    Motivation
    GC Paging Behavior
    Hippocratic Garbage Collection
         Cooperation
         Bookmarking
    Results
    Future Work



    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   33
Methodology
   Jikes RVM, MMTk, extended Linux kernel
   “OPT + reset”
         Opt-compile first, full collection,
          second timing run
   Benchmarks:
         SPECjvm98, DaCapo suite (ipsixql, jython)
         SPECjbb variant (pseudojbb)
   Signalmem for memory pressure
         Dynamic (30MB, then 60MB)
         Static (40% of heap available)

    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   34
    Execution time:
    No Memory Pressure




   Generally runs in smaller heaps, fast as GenMS
     UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   35
Execution Time:
No Memory Pressure – pseudoJBB




   CopyMS, etc. at least 6%-89% slower
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   36
    Execution Time:
    Dynamic Memory Pressure




   Startup process: 30MB, then 60MB more
     UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   37
    Pause Time:
    Dynamic Memory Pressure




   Startup process: 30MB, then 60MB more
     UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   38
Execution Time:
Constant Memory Pressure




   Memory sufficient to hold 40% of heap
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   39
Pause Times:
Constant Memory Pressure




   Memory sufficient to hold 40% of heap
    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   40
Future Work

   Different eviction strategies
         Exploit type info, fewer pointers
   Richer summaries
   Shrink heap vs. evict pages; grow heap
         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

   Hippocratic Garbage Collection
         Cooperates with VM
         Competitive when not paging
              Performs up to 13% faster with small heaps
              As fast as GenMS for larger heaps
         Greatly improves performance when paging
              Throughput up to 3x greater
              Average pause times up to 30x smaller than
               CopyMS, 70x smaller than GenMS


    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   42
Backup Slides




 UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   43
Some Related Work

   Compaction: reduce working set
         Linearize lists [Bobrow & Murphy]
         Semispace collection [Baker, Fenichel & Yochelson]
   Reduce frequency of whole-heap collection
         Ephemeral [Moon] & generational collectors
          [Lieberman & Hewett, Ungar, Appel]
   Cooperation
         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             protected




   Maintain histogram per page position
         Provides value to application of n pages (for any n)

    UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science   45

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:4
posted:9/11/2012
language:Unknown
pages:45