U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Matthew Hertz, Yi Feng, &...
-
Upload
jalen-farless -
Category
Documents
-
view
216 -
download
2
Transcript of U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Matthew Hertz, Yi Feng, &...
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science
Matthew Hertz, Yi Feng, & Emery Berger
Department of Computer ScienceUniversity of Massachusetts
Hippocratic Garbage Collection
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 2
Dude, where’s my performance?
Sun HotSpot JDK 1.4.1, Java Beans benchmark
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 3
Ever-Steeper Memory Hierarchy
Higher = smaller, faster, closer to CPU A real desktop machine (mine)
registers
L1 cache
L2 cache
RAM
Disk
8 integer, 8 floating-point; 1-cycle latency
8K data & instructions; 2-cycle latency
512K; 7-cycle latency
1GB; 100 cycle latency
40 GB; 38,000,000 cycle latency (!)
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 4
Program Throughput: Ideal vs. Real
492 113 103 930
100
200
300
400
500
600
700
800
900
1000
Execution Time for pseudoJBB with 60MB Heap
IdealGenCopyGenMS
Available Memory (in MB)
Exe
cuti
on T
ime (
in s
)
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 5
GC Pause Time
492 113 103 930
5
10
15
20
25
30
35
Max Garbage Collection Pause for pseudoJBB
GenCopyGenMS
Available Memory (in MB)
Avg.
GC
Pause
(in
s)
From 55 milliseconds to 30 seconds!..Can we avoid this?
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 6
Memory Prices Over TimeRAM Prices Over Time
(1977 dollars)
$0.01
$0.10
$1.00
$10.00
$100.00
$1,000.00
$10,000.00
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
Do
llars
per
GB
2K
8K
32K
128K
512K
2M
8M
conventional DRAM
“Soon it will be free…”
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 7
Memory Prices: Inflection Point
RAM Prices Over Time(1977 dollars)
$0.01
$0.10
$1.00
$10.00
$100.00
$1,000.00
$10,000.00
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
Do
llars
per
GB
2K
8K
32K
128K
512K
2M
8M
512M
1G
SDRAM,RDRAM,DDR,Chipkill
conventional DRAM
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 8
Memory Not So Free
Servers: buy 4GB,get 1 CPU free!
Sun E10000: 4GB extra = $75,000!
Fast RAM Cosmic rays…
4GB Sun RAM = ½ Ferrari Modena
“Buy more RAM” = “Ferraris for Everyone”
Desktops: most 256MB 1GB = 50% more $ Laptops = 70%, if possible
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 9
Fast DDR2 modules today: $500/GB
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 10
Outline
Motivation GC Paging Behavior Hippocratic Garbage Collection
Cooperation Bookmarking
Results Future Work
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 11
What’s really going on here?
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 12
GC Performance While Paging
RAM
Hard Disk
GC: Touch evicted page
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 13
RAM
Hard Disk
GC Performance While Paging
VM: brings page in-core
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 14
RAM
Hard Disk
GC Performance While Paging
VM: evicts different page (LRU)
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 15
RAM
Hard Disk
GC Performance While Paging
GC: Touches page on disk
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 16
RAM
Hard Disk
GC Performance While Paging
VM: Evicts another page…and so on…
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 17
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
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 18
Outline
Motivation GC Paging Behavior Hippocratic Garbage
Collection Cooperation Bookmarking
Results Future Work
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 19
Our Inspiration
As to diseases,
make a habit of two things: to help, or at least, to do no harm.
Hippocrates
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 20
Hippocratic Garbage Collection
Goal: GC triggers no additional paging Key ideas:
Minimize space consumption Exploit page information from VM
Residency, eviction notifications Avoid touching evicted pages
Garbage collector Virtual memory manager
Evacuates pagesSelects victim pages
Page replacement
page eviction notification
victim page(s)
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 21
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
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 22
Segregated Size Classes
Mark objects
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 23
Segregated Size Classes
Copy into empty spaces
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 24
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”
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 25
Process pages before they are evicted…
RAM
Hard Disk
Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 26
…by “bookmarking” target objects
RAM
Hard Disk
Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 27
then allow page eviction
RAM
Hard Disk
Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 28
process objects as normal except…
RAM
Hard Disk
Collection with Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 29
…ignore references to evicted pages
RAM
Hard Disk
Collection with Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 30
bookmarks remember references from disk
RAM
Hard Disk
Collection with Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 31
Result: no paging!
RAM
Hard Disk
Collection with Bookmarking
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 32
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
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 33
Outline
Motivation GC Paging Behavior Hippocratic Garbage
Collection Cooperation Bookmarking
Results Future Work
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 34
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)
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 35
Execution time:No Memory Pressure
Generally runs in smaller heaps, fast as GenMS
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 36
Execution Time:No Memory Pressure – pseudoJBB
CopyMS, etc. at least 6%-89% slower
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 37
Execution Time:Dynamic Memory Pressure
Startup process: 30MB, then 60MB more
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 38
Pause Time:Dynamic Memory Pressure
Startup process: 30MB, then 60MB more
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 39
Execution Time:Constant Memory Pressure
Memory sufficient to hold 40% of heap
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 40
Pause Times:Constant Memory Pressure
Memory sufficient to hold 40% of heap
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 41
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]
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 42
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
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 43
Backup Slides
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 44
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.]
UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTSASSACHUSETTS, A, AMHERST • MHERST • Department of Computer Science Department of Computer Science 45
Tracking Page Value
Maintain histogram per page position Provides value to application of n pages (for any
n)
unprotected protected