SlideShare a Scribd company logo
CRAMM: Virtual Memory Support for Garbage-Collected Applications Ting Yang, Emery Berger, Scott Kaplan † , Eliot Moss Department of Computer Science  Dept. of Math and Computer Science † University of Massachusetts  Amherst College  {tingy,emery,moss}@cs.umass.edu  [email_address]
Motivation: Heap Size Matters GC languages Java, C#, Python, Ruby, etc. Increasingly popular Heap size  critical Too large:  Paging (10-100x slower) Too small:  Excessive # collections hurts throughput Heap Size (120MB) Memory (100MB) JVM VM/OS Disk Heap Size ( 6 0MB) Memory (100MB)
What is the right heap size? Find the sweet spot : Large enough to minimize collections Small enough to avoid paging BUT: sweet spot changes constantly  (multiprogramming) CRAMM:  C ooperative  R obust  A utomatic  M emory  M anagement Goal : through cooperation with OS & GC, keep garbage-collected applications running at their sweet spot
CRAMM Overview Cooperative approach: Collector-neutral  heap sizing model  (GC) suitable for broad range of collectors Statistics-gathering  VM (OS) Automatically resizes heap in response to memory pressure Grows to maximize space utilization Shrinks to eliminate paging Improves performance by up to 20x Overhead on non-GC apps: 1-2.5%
Outline Motivation CRAMM overview Automatic heap sizing Information gathering Experimental results Conclusion
GC : How do we choose a good  heap size?
GC: Collector-neutral model SemiSpace  (copying) a  ≈  ½ b  ≈  JVM, code + app’s live size heapUtilFactor:  constant dependent on GC algorithm Fixed overhead : Libraries, codes, copying (app’s live size)
GC: a collector-neutral WSS model SemiSpace  (copying) MS  (non-copying) a  ≈  ½ b  ≈  JVM, code + app’s live size a  ≈  1 b  ≈  JVM, code heapUtilFactor:  constant dependent on GC algorithm Fixed overhead : Libraries, codes, copying (app’s live size)
GC: Selecting new heap size GC:  heapUtilFactor (a)  &  cur_heapSize   VMM:  WSS  &  available memory Set heap size so that working set just fits  in current available memory
Heap Size vs. Execution time, WSS 1/x shape Y=0.99*X + 32.56 Linear shape
VM : How do we collect information to support heap size selection? (with low overhead) WSS, Available Memory
Calculating WSS w.r.t 5% Memory reference sequence LRU Queue Pages in Least Recently Used order Hit Histogram Fault Curve 1 14 5 1 1 14 11 4 Associated with each LRU position pages faults d e f g h i j k l m n c k l m n c b c d e f g h i j k l m n c k l m n a b a a b c d e f g h i j k l m n a b c d e f g h i j k l m n a b d e f g h i j c k l n m a b c d e f g h i j k m n l a b c d e f g h i j l m n k a b d e f g h i j k l m n c 4 n 3 2 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 m n l m n k l m n c k l m n a b c d e f g h i j k l m n c k l m n
Computing hit histogram Not possible in standard VM: Global LRU queues No per process/file information or control Difficult to estimate app’s WSS / available memory CRAMM VM: Per process/file page management:  Page list:  Active ,  Inactive ,  Evicted Add & maintain histogram
Managing pages for a process Active (CLOCK) Inactive  (LRU) Evicted  (LRU)   Major  fault Evicted Refill & Adjustment Minor fault Pages protected by turning off permissions (minor fault) Pages evicted to disk. (major fault) Histogram Pages faults Header Page Des AVL node
Controlling overhead Buffer Active (CLOCK) Inactive  (LRU) Evicted  (LRU)   Pages protected by turning off permissions (minor fault) Pages evicted to disk. (major fault) Histogram Pages faults control the boundary:  1% of execution time Header Page Des AVL node
Calculating available memory What’s “available”? Page cache Are pages from closed files “free”? Policy decision:  yes Easy to distinguish in CRAMM – on separate list Available Memory =   resident application pages  +   free pages in the system  +   pages from closed files
Experimental Results
Experimental Evaluation Experimental setup: CRAMM (Jikes RVM + Linux), unmodified Jikes RVM, JRockit, HotSpot GC:  GenCopy, CopyMS,  MS, SemiSpace, GenMS SPECjvm98, DaCapo, SPECjbb, ipsixql + SPEC2000 Experiments: Dynamic  memory pressure Overhead w/o memory pressure
Dynamic Memory Pressure (1)   stock w/o pressure 296.67 secs 1136 majflts CRAMM w/ pressure  302.53 secs 1613 majflts 98% CPU Stock w/ pressure   720.11 secs 39944 majflts 48% CPU I nitial heap size: 120MB Elapsed Time (seconds) GenMS  –  SPECjbb (Modified) w/ 160M memory s tock w/o pressure CRAMM  w/ pressure # transactions finished (thousands) S tock w/ pressure
Dynamic Memory Pressure (2)  SPECjbb (modified): Normalized Elapsed Time JRockit HotSpot CRAMM-GenMS CRAMM-MS CRAMM-SS HotSpot JRockit # transactions finished (thousands)
CRAMM VM: Efficiency   Overhead: on average, 1% - 2.5% CRAMM VM Overhead 0 0.5 1 1.5 2 2.5 3 3.5 4 SPEC2Kint SPEC2Kfp Java- GenCopy Java- SemiSpace Java- MarkSweep Java-GenMS Java- CopyMS % Overhead Additional Overhead Histogram Collection
Conclusion Cooperative Robust Automatic Memory Management ( CRAMM ) GC: Collector-neutral WSS model VM: Statistics-gathering virtual memory manager Dynamically chooses nearly-optimal heap size for garbage-collected applications Maximizes use of memory without paging Minimal overhead (1% - 2.5%) Quickly adapts to memory pressure changes http://www.cs.umass.edu/~tingy/CRAMM
 
Backup Slides Example of paging Problem, javac Understanding fault curves Characterizing Paging Behavior Using fault curves / LRU SegQ design Collecting fault curves on the fly Calculating WSS of GCed applications
Characterizing Paging Behavior Memory reference sequence LRU Queue Pages in Least Recently Used order Hit Histogram Fault Curve 1 14 5 1 1 14 11 4 12 pages 5 pages Associated with each LRU position d e f g h i j k l m n c k l m n c b c d e f g h i j k l m n c k l m n a b a a b c d e f g h i j k l m n a b c d e f g h i j k l m n a b d e f g h i j c k l n m a b c d e f g h i j k m n l a b c d e f g h i j l m n k a b d e f g h i j k l m n c 4 n 3 2 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 m n l m n k l m n c k l m n a b c d e f g h i j k l m n c k l m n
Heap Size = 240Mb Memory = 145Mb # of Faults  ≈  1000 50 seconds extreme paging substantial paging: “ looping” behavior fits into memory Fault curve: Relationship of heap size, real memory & page faults Heap size= 0.5 second
VMM design: SegQ LRU Queue Hit Histogram Active Inactive Evicted Active / Inactive Boundary CLOCK algorithm Strict LRU Adaptive control of Inactive list size Major fault (on disk) Minor fault (in memory) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
VMM design: SegQ Active Inactive Evicted Active / Inactive Boundary CLOCK algorithm Strict LRU WSS What is the WSS w.r.t 5%? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CRAMM System: Demo JVM Memory (150MB) Other Apps Heap Size (120MB) Need  6 0MB memory Polling Memory Status GC: Memory exhausted, triggers a full collection … Collection Finished GC: Collection is finished; Memory is released VM: Calculates app’s WSS and Available memory WSS, Available Memory GC: Choose a new heap size using WSS model Heap Size ( 1 00 MB) Heap Size ( 90 MB) Heap Size ( 150 MB) VM M GC: Shrinks the heap size again Other apps finished GC: Grows the heap size to make better use of memory
CRAMM VM: Control overhead Goal: 1% of execution time < 0.5%: grow inactive list size > 1.5%: shrink inactive list size When Interval: 1/16 seconds # of minflts > (interval * 2%) / minflt_cost How Grow: min(active, inactive)/32 Shrink: min(active, inactive)/8 Refill: min(active, inactive)/16
CRAMM vs. Bookmarking Collector Two different approaches CRAMM: A new VMM Moderate modifications in collectors Heap level control (coarse granularity) BC:  A new collector Moderate modifications in VMM Page level control (fine granularity)
Static Memory Pressure optimal
Dynamic Memory Pressure (1) Initial heap size: 120MB stock w/o pressure 336.17 secs 1136 majflts CRAMM w/ pressure  386.88 secs 1179 majflts 98% CPU Stock w/ pressure   928.49 secs 47941 majflts 36% CPU
Dynamic Memory Pressure (1) Available memory Heap size Sample after every collection adaptive
Dynamic Memory Pressure (3)
Appel _213_javac 60MB real memory Too small: GC a lot Too large: page a lot Optimal Problem & Motivation Heap size  vs  Running time
Manage processes/files mem_info  structure organization Unused list : closed files Normal list : running processes, files in use Handling files close: deactivate all pages, move to  unused  list open: move to  normal  list, rebuild its active list  Eviction policy Scan  Unused  list first Then select from  normal  list in round-robin manner
Behind the WSS model? Stop-the-world, tracing collectors Two phases:  mutator  and  collector Mutator:  runs the app Allocation, references existing objects Collector: Traces pointers for live objects GC behavior dominates: no “ infrequently ” used pages Base rate: at least once for each GC cycle Working Set Size (WSS) the amount of memory needed so that the time spent on page faults is lower than certain percent of total execution time. (5%)
GC gives more choices ! Non-GCed Application GCed Application W(k,t) k k W(k,t) Heap: 20MB Heap: 30MB Heap: 45MB Heap: 65MB Working Set Size  W(k, t) : at time  t , the set of all pages used  k  most recent references Memory pressure  , scan frequency  , k  , WSS  , more pages can be evicted, page faults  , running time  Larger search space. Change heap size, change WSS, avoid page faults, less impact on running time Hmm… a search problem! Search Criteria   Working Set Size: The amount of memory needed so that the time spent on page faults is lower than certain percent of total execution time. (typical  value: 5%)

More Related Content

What's hot (20)

PDF
Solving Multi-tenancy and G1GC in Apache HBase
HBaseCon
 
PDF
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
PPTX
Java 어플리케이션 성능튜닝 Part1
상욱 송
 
PDF
Antonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos
 
PDF
Mastering java in containers - MadridJUG
Jorge Morales
 
PDF
On heap cache vs off-heap cache
rgrebski
 
PPTX
Sun jdk 1.6 gc english version
bluedavy lin
 
PDF
Thanos - Prometheus on Scale
Bartłomiej Płotka
 
PDF
クラウド時代の半導体メモリー技術
Ryousei Takano
 
PPTX
20141219 workshop methylation sequencing analysis
Yi-Feng Chang
 
PPT
jvm goes to big data
srisatish ambati
 
PDF
On the way to low latency
Artem Orobets
 
PDF
Scaling Apache Pulsar to 10 Petabytes/Day
ScyllaDB
 
PDF
Where Did All These Cycles Go?
ScyllaDB
 
PDF
Continuous Go Profiling & Observability
ScyllaDB
 
PPTX
Pick diamonds from garbage
Tier1 App
 
DOCX
Doc5
Rupinder Sidhu
 
PDF
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
Alexey Lesovsky
 
PDF
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
PDF
Pgcenter overview
Alexey Lesovsky
 
Solving Multi-tenancy and G1GC in Apache HBase
HBaseCon
 
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
Java 어플리케이션 성능튜닝 Part1
상욱 송
 
Antonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos
 
Mastering java in containers - MadridJUG
Jorge Morales
 
On heap cache vs off-heap cache
rgrebski
 
Sun jdk 1.6 gc english version
bluedavy lin
 
Thanos - Prometheus on Scale
Bartłomiej Płotka
 
クラウド時代の半導体メモリー技術
Ryousei Takano
 
20141219 workshop methylation sequencing analysis
Yi-Feng Chang
 
jvm goes to big data
srisatish ambati
 
On the way to low latency
Artem Orobets
 
Scaling Apache Pulsar to 10 Petabytes/Day
ScyllaDB
 
Where Did All These Cycles Go?
ScyllaDB
 
Continuous Go Profiling & Observability
ScyllaDB
 
Pick diamonds from garbage
Tier1 App
 
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
Alexey Lesovsky
 
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
Pgcenter overview
Alexey Lesovsky
 

Viewers also liked (20)

PPS
Information Systems and Technologies used in the framework of the TIR Convention
José Ferreiro
 
PPT
Retos de los CIOs
Max Ugaz
 
PDF
Termostato wifi para controlar calefacción desde tu Smartphone
Alberto Vázquez Garea
 
DOCX
Tecnología invisible,para producir mentes activas
Suham S. Reyes
 
PPT
TP
Juan
 
PDF
Transistores
simonvall
 
PPTX
Marketing de afiliación
Ivan Bedia García
 
PPTX
Personalisatie en synchronisatie tussen Magento webshop en Copernica
Copernica BV
 
PDF
Tesiandroid
guestf3c3c1a
 
PPTX
Annac, st. john,miller,ostertaag combined pp ccp13 ccp13
bio-link
 
PPTX
Tm call free & sms free
Fadhil Bangi
 
PDF
Sedes auca
Angel Barrios
 
PPT
De ciencia ficcion_a_ciencia_real_tecnologias_emergentes
Jim "Brodie" Brazell
 
PPTX
Gilbs agile principles and values agilia conf keynote brno cz march 27 2013
tom gilb
 
PPTX
Chapter 3 grammar
amandamccartney
 
PPTX
E tourism
STIinnsbruck
 
PPT
Hirikilabs How To Make 01: Enabling the Future
TabakaleraDonostia
 
PDF
Cultura Empresarial y Dirección.
Almudena Valdor
 
DOC
Manual margarita
Rodrigo Salas
 
Information Systems and Technologies used in the framework of the TIR Convention
José Ferreiro
 
Retos de los CIOs
Max Ugaz
 
Termostato wifi para controlar calefacción desde tu Smartphone
Alberto Vázquez Garea
 
Tecnología invisible,para producir mentes activas
Suham S. Reyes
 
TP
Juan
 
Transistores
simonvall
 
Marketing de afiliación
Ivan Bedia García
 
Personalisatie en synchronisatie tussen Magento webshop en Copernica
Copernica BV
 
Tesiandroid
guestf3c3c1a
 
Annac, st. john,miller,ostertaag combined pp ccp13 ccp13
bio-link
 
Tm call free & sms free
Fadhil Bangi
 
Sedes auca
Angel Barrios
 
De ciencia ficcion_a_ciencia_real_tecnologias_emergentes
Jim "Brodie" Brazell
 
Gilbs agile principles and values agilia conf keynote brno cz march 27 2013
tom gilb
 
Chapter 3 grammar
amandamccartney
 
E tourism
STIinnsbruck
 
Hirikilabs How To Make 01: Enabling the Future
TabakaleraDonostia
 
Cultura Empresarial y Dirección.
Almudena Valdor
 
Manual margarita
Rodrigo Salas
 
Ad

Similar to CRAMM: Virtual Memory Support for Garbage-Collected Applications (20)

PDF
Native Code & Off-Heap Data Structures for Solr: Presented by Yonik Seeley, H...
Lucidworks
 
PPTX
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)
Yonik Seeley
 
PPTX
IMC Summit 2016 Breakout - Per Minoborg - Work with Multiple Hot Terabytes in...
In-Memory Computing Summit
 
PPTX
JVM Magic
Baruch Sadogursky
 
PPT
Advanced off heap ipc
Peter Lawrey
 
PPT
Performance tuning jvm
Prem Kuppumani
 
PDF
Garbage collection in JVM
aragozin
 
PPTX
Jvm problem diagnostics
Danijel Mitar
 
PDF
제2회난공불락 오픈소스 세미나 커널튜닝
Tommy Lee
 
PDF
Flink Forward Berlin 2017: Robert Metzger - Keep it going - How to reliably a...
Flink Forward
 
PPTX
HBase Accelerated: In-Memory Flush and Compaction
DataWorks Summit/Hadoop Summit
 
PDF
Basics of JVM Tuning
Vladislav Gangan
 
PDF
Software Profiling: Java Performance, Profiling and Flamegraphs
Isuru Perera
 
PPTX
HotSpot JVM Tuning
Gilad Garon
 
PPTX
Distributed caching-computing v3.8
Rahul Gupta
 
PDF
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
PPTX
CPN302 your-linux-ami-optimization-and-performance
Coburn Watson
 
DOCX
Virtual memory pre-final-formatting
marangburu42
 
PDF
Introduction to Java performance tuning
Marouane Gazanayi
 
PDF
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
Native Code & Off-Heap Data Structures for Solr: Presented by Yonik Seeley, H...
Lucidworks
 
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)
Yonik Seeley
 
IMC Summit 2016 Breakout - Per Minoborg - Work with Multiple Hot Terabytes in...
In-Memory Computing Summit
 
Advanced off heap ipc
Peter Lawrey
 
Performance tuning jvm
Prem Kuppumani
 
Garbage collection in JVM
aragozin
 
Jvm problem diagnostics
Danijel Mitar
 
제2회난공불락 오픈소스 세미나 커널튜닝
Tommy Lee
 
Flink Forward Berlin 2017: Robert Metzger - Keep it going - How to reliably a...
Flink Forward
 
HBase Accelerated: In-Memory Flush and Compaction
DataWorks Summit/Hadoop Summit
 
Basics of JVM Tuning
Vladislav Gangan
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Isuru Perera
 
HotSpot JVM Tuning
Gilad Garon
 
Distributed caching-computing v3.8
Rahul Gupta
 
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
CPN302 your-linux-ami-optimization-and-performance
Coburn Watson
 
Virtual memory pre-final-formatting
marangburu42
 
Introduction to Java performance tuning
Marouane Gazanayi
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
Ad

More from Emery Berger (20)

PPTX
Doppio: Breaking the Browser Language Barrier
Emery Berger
 
PPTX
Dthreads: Efficient Deterministic Multithreading
Emery Berger
 
PDF
Programming with People
Emery Berger
 
PDF
Stabilizer: Statistically Sound Performance Evaluation
Emery Berger
 
PDF
DieHarder (CCS 2010, WOOT 2011)
Emery Berger
 
PDF
Operating Systems - Advanced File Systems
Emery Berger
 
PDF
Operating Systems - File Systems
Emery Berger
 
PDF
Operating Systems - Networks
Emery Berger
 
PDF
Operating Systems - Queuing Systems
Emery Berger
 
PDF
Operating Systems - Distributed Parallel Computing
Emery Berger
 
PDF
Operating Systems - Concurrency
Emery Berger
 
PDF
Operating Systems - Advanced Synchronization
Emery Berger
 
PDF
Operating Systems - Synchronization
Emery Berger
 
PDF
Processes and Threads
Emery Berger
 
PDF
Virtual Memory and Paging
Emery Berger
 
PDF
Operating Systems - Virtual Memory
Emery Berger
 
PPT
MC2: High-Performance Garbage Collection for Memory-Constrained Environments
Emery Berger
 
PPT
Vam: A Locality-Improving Dynamic Memory Allocator
Emery Berger
 
PPT
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
Emery Berger
 
PDF
Garbage Collection without Paging
Emery Berger
 
Doppio: Breaking the Browser Language Barrier
Emery Berger
 
Dthreads: Efficient Deterministic Multithreading
Emery Berger
 
Programming with People
Emery Berger
 
Stabilizer: Statistically Sound Performance Evaluation
Emery Berger
 
DieHarder (CCS 2010, WOOT 2011)
Emery Berger
 
Operating Systems - Advanced File Systems
Emery Berger
 
Operating Systems - File Systems
Emery Berger
 
Operating Systems - Networks
Emery Berger
 
Operating Systems - Queuing Systems
Emery Berger
 
Operating Systems - Distributed Parallel Computing
Emery Berger
 
Operating Systems - Concurrency
Emery Berger
 
Operating Systems - Advanced Synchronization
Emery Berger
 
Operating Systems - Synchronization
Emery Berger
 
Processes and Threads
Emery Berger
 
Virtual Memory and Paging
Emery Berger
 
Operating Systems - Virtual Memory
Emery Berger
 
MC2: High-Performance Garbage Collection for Memory-Constrained Environments
Emery Berger
 
Vam: A Locality-Improving Dynamic Memory Allocator
Emery Berger
 
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
Emery Berger
 
Garbage Collection without Paging
Emery Berger
 

Recently uploaded (20)

PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 

CRAMM: Virtual Memory Support for Garbage-Collected Applications

  • 1. CRAMM: Virtual Memory Support for Garbage-Collected Applications Ting Yang, Emery Berger, Scott Kaplan † , Eliot Moss Department of Computer Science Dept. of Math and Computer Science † University of Massachusetts Amherst College {tingy,emery,moss}@cs.umass.edu [email_address]
  • 2. Motivation: Heap Size Matters GC languages Java, C#, Python, Ruby, etc. Increasingly popular Heap size critical Too large: Paging (10-100x slower) Too small: Excessive # collections hurts throughput Heap Size (120MB) Memory (100MB) JVM VM/OS Disk Heap Size ( 6 0MB) Memory (100MB)
  • 3. What is the right heap size? Find the sweet spot : Large enough to minimize collections Small enough to avoid paging BUT: sweet spot changes constantly (multiprogramming) CRAMM: C ooperative R obust A utomatic M emory M anagement Goal : through cooperation with OS & GC, keep garbage-collected applications running at their sweet spot
  • 4. CRAMM Overview Cooperative approach: Collector-neutral heap sizing model (GC) suitable for broad range of collectors Statistics-gathering VM (OS) Automatically resizes heap in response to memory pressure Grows to maximize space utilization Shrinks to eliminate paging Improves performance by up to 20x Overhead on non-GC apps: 1-2.5%
  • 5. Outline Motivation CRAMM overview Automatic heap sizing Information gathering Experimental results Conclusion
  • 6. GC : How do we choose a good heap size?
  • 7. GC: Collector-neutral model SemiSpace (copying) a ≈ ½ b ≈ JVM, code + app’s live size heapUtilFactor: constant dependent on GC algorithm Fixed overhead : Libraries, codes, copying (app’s live size)
  • 8. GC: a collector-neutral WSS model SemiSpace (copying) MS (non-copying) a ≈ ½ b ≈ JVM, code + app’s live size a ≈ 1 b ≈ JVM, code heapUtilFactor: constant dependent on GC algorithm Fixed overhead : Libraries, codes, copying (app’s live size)
  • 9. GC: Selecting new heap size GC: heapUtilFactor (a) & cur_heapSize VMM: WSS & available memory Set heap size so that working set just fits in current available memory
  • 10. Heap Size vs. Execution time, WSS 1/x shape Y=0.99*X + 32.56 Linear shape
  • 11. VM : How do we collect information to support heap size selection? (with low overhead) WSS, Available Memory
  • 12. Calculating WSS w.r.t 5% Memory reference sequence LRU Queue Pages in Least Recently Used order Hit Histogram Fault Curve 1 14 5 1 1 14 11 4 Associated with each LRU position pages faults d e f g h i j k l m n c k l m n c b c d e f g h i j k l m n c k l m n a b a a b c d e f g h i j k l m n a b c d e f g h i j k l m n a b d e f g h i j c k l n m a b c d e f g h i j k m n l a b c d e f g h i j l m n k a b d e f g h i j k l m n c 4 n 3 2 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 m n l m n k l m n c k l m n a b c d e f g h i j k l m n c k l m n
  • 13. Computing hit histogram Not possible in standard VM: Global LRU queues No per process/file information or control Difficult to estimate app’s WSS / available memory CRAMM VM: Per process/file page management: Page list: Active , Inactive , Evicted Add & maintain histogram
  • 14. Managing pages for a process Active (CLOCK) Inactive (LRU) Evicted (LRU) Major fault Evicted Refill & Adjustment Minor fault Pages protected by turning off permissions (minor fault) Pages evicted to disk. (major fault) Histogram Pages faults Header Page Des AVL node
  • 15. Controlling overhead Buffer Active (CLOCK) Inactive (LRU) Evicted (LRU) Pages protected by turning off permissions (minor fault) Pages evicted to disk. (major fault) Histogram Pages faults control the boundary: 1% of execution time Header Page Des AVL node
  • 16. Calculating available memory What’s “available”? Page cache Are pages from closed files “free”? Policy decision: yes Easy to distinguish in CRAMM – on separate list Available Memory = resident application pages + free pages in the system + pages from closed files
  • 18. Experimental Evaluation Experimental setup: CRAMM (Jikes RVM + Linux), unmodified Jikes RVM, JRockit, HotSpot GC: GenCopy, CopyMS, MS, SemiSpace, GenMS SPECjvm98, DaCapo, SPECjbb, ipsixql + SPEC2000 Experiments: Dynamic memory pressure Overhead w/o memory pressure
  • 19. Dynamic Memory Pressure (1) stock w/o pressure 296.67 secs 1136 majflts CRAMM w/ pressure 302.53 secs 1613 majflts 98% CPU Stock w/ pressure 720.11 secs 39944 majflts 48% CPU I nitial heap size: 120MB Elapsed Time (seconds) GenMS – SPECjbb (Modified) w/ 160M memory s tock w/o pressure CRAMM w/ pressure # transactions finished (thousands) S tock w/ pressure
  • 20. Dynamic Memory Pressure (2) SPECjbb (modified): Normalized Elapsed Time JRockit HotSpot CRAMM-GenMS CRAMM-MS CRAMM-SS HotSpot JRockit # transactions finished (thousands)
  • 21. CRAMM VM: Efficiency Overhead: on average, 1% - 2.5% CRAMM VM Overhead 0 0.5 1 1.5 2 2.5 3 3.5 4 SPEC2Kint SPEC2Kfp Java- GenCopy Java- SemiSpace Java- MarkSweep Java-GenMS Java- CopyMS % Overhead Additional Overhead Histogram Collection
  • 22. Conclusion Cooperative Robust Automatic Memory Management ( CRAMM ) GC: Collector-neutral WSS model VM: Statistics-gathering virtual memory manager Dynamically chooses nearly-optimal heap size for garbage-collected applications Maximizes use of memory without paging Minimal overhead (1% - 2.5%) Quickly adapts to memory pressure changes http://www.cs.umass.edu/~tingy/CRAMM
  • 23.  
  • 24. Backup Slides Example of paging Problem, javac Understanding fault curves Characterizing Paging Behavior Using fault curves / LRU SegQ design Collecting fault curves on the fly Calculating WSS of GCed applications
  • 25. Characterizing Paging Behavior Memory reference sequence LRU Queue Pages in Least Recently Used order Hit Histogram Fault Curve 1 14 5 1 1 14 11 4 12 pages 5 pages Associated with each LRU position d e f g h i j k l m n c k l m n c b c d e f g h i j k l m n c k l m n a b a a b c d e f g h i j k l m n a b c d e f g h i j k l m n a b d e f g h i j c k l n m a b c d e f g h i j k m n l a b c d e f g h i j l m n k a b d e f g h i j k l m n c 4 n 3 2 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 m n l m n k l m n c k l m n a b c d e f g h i j k l m n c k l m n
  • 26. Heap Size = 240Mb Memory = 145Mb # of Faults ≈ 1000 50 seconds extreme paging substantial paging: “ looping” behavior fits into memory Fault curve: Relationship of heap size, real memory & page faults Heap size= 0.5 second
  • 27. VMM design: SegQ LRU Queue Hit Histogram Active Inactive Evicted Active / Inactive Boundary CLOCK algorithm Strict LRU Adaptive control of Inactive list size Major fault (on disk) Minor fault (in memory) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 28. VMM design: SegQ Active Inactive Evicted Active / Inactive Boundary CLOCK algorithm Strict LRU WSS What is the WSS w.r.t 5%? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 29. CRAMM System: Demo JVM Memory (150MB) Other Apps Heap Size (120MB) Need 6 0MB memory Polling Memory Status GC: Memory exhausted, triggers a full collection … Collection Finished GC: Collection is finished; Memory is released VM: Calculates app’s WSS and Available memory WSS, Available Memory GC: Choose a new heap size using WSS model Heap Size ( 1 00 MB) Heap Size ( 90 MB) Heap Size ( 150 MB) VM M GC: Shrinks the heap size again Other apps finished GC: Grows the heap size to make better use of memory
  • 30. CRAMM VM: Control overhead Goal: 1% of execution time < 0.5%: grow inactive list size > 1.5%: shrink inactive list size When Interval: 1/16 seconds # of minflts > (interval * 2%) / minflt_cost How Grow: min(active, inactive)/32 Shrink: min(active, inactive)/8 Refill: min(active, inactive)/16
  • 31. CRAMM vs. Bookmarking Collector Two different approaches CRAMM: A new VMM Moderate modifications in collectors Heap level control (coarse granularity) BC: A new collector Moderate modifications in VMM Page level control (fine granularity)
  • 33. Dynamic Memory Pressure (1) Initial heap size: 120MB stock w/o pressure 336.17 secs 1136 majflts CRAMM w/ pressure 386.88 secs 1179 majflts 98% CPU Stock w/ pressure 928.49 secs 47941 majflts 36% CPU
  • 34. Dynamic Memory Pressure (1) Available memory Heap size Sample after every collection adaptive
  • 36. Appel _213_javac 60MB real memory Too small: GC a lot Too large: page a lot Optimal Problem & Motivation Heap size vs Running time
  • 37. Manage processes/files mem_info structure organization Unused list : closed files Normal list : running processes, files in use Handling files close: deactivate all pages, move to unused list open: move to normal list, rebuild its active list Eviction policy Scan Unused list first Then select from normal list in round-robin manner
  • 38. Behind the WSS model? Stop-the-world, tracing collectors Two phases: mutator and collector Mutator: runs the app Allocation, references existing objects Collector: Traces pointers for live objects GC behavior dominates: no “ infrequently ” used pages Base rate: at least once for each GC cycle Working Set Size (WSS) the amount of memory needed so that the time spent on page faults is lower than certain percent of total execution time. (5%)
  • 39. GC gives more choices ! Non-GCed Application GCed Application W(k,t) k k W(k,t) Heap: 20MB Heap: 30MB Heap: 45MB Heap: 65MB Working Set Size W(k, t) : at time t , the set of all pages used k most recent references Memory pressure , scan frequency , k , WSS , more pages can be evicted, page faults , running time Larger search space. Change heap size, change WSS, avoid page faults, less impact on running time Hmm… a search problem! Search Criteria Working Set Size: The amount of memory needed so that the time spent on page faults is lower than certain percent of total execution time. (typical value: 5%)