1 Heap Sizing
1.1 Control Theory for Principled Heap Sizing
1.1.1 Intro
- Programs frequently have seperate phases with very different memory behavior, no static heuristic acceptable
- Control theory offers more formalism than trying to glue random, effective heuristics together.
- Paper describes the idea of having a GC controller and increasing the heap size until the heap thrashing decreases and a throughput goal is hit.
1.1.2 Sweet spots
- If heap too large, paging will impact performance. If too small, will thrash heap.
- Can see a parabolic curve of running time and heap size. Ahead-of-time choice of heap size by benchmarking tends to not work though.
1.1.3 Heap sizing in existing VMs.
- Existing VMs tend to increase heap size too optimistically, and decrease it more slowly than could be desired.
- Jikes RVM
- After each GC, manager determines new "resize ratio" based on short term GC overhead (ratio of gc time and time since last GC) and ratio of heap that was live
- Is an index into a lookup table of hard-coded values found by trial-and-error
- Not explicitly goal-oriented in terms of throughput or heap size
- Doesn't take history into account, can flip-flop between states needlessly when live data size fluctuates back and forth quickly.
- There is no evidence that different GC algorithms will match these hard-coded heuristic thresholds
- Hotspot
- Has a lot of tunable "ergonomics," and will resize heap to make best-effort to meet all priorities.
- Resizing rate much less flexible, ratio bounded between 0.95 and 1.2. Early on in execution, allows to grow at ratio 2.
- Venegrov has questioned whether the resize policies actually ensure progress towards goals.
1.1.4 Heap sizing as a control problem
- Should use control theory
- Control theory mature in engineering
- Responds to both inputs and current deviation from goal.
- Software is very much like such a system, since software phase changes and sudden need to perform expensive, less frequent mode, can be seen as change to goal.
- Definitions:
- Steady-state error: The error that a system has after it's allowed to hit a steady state after trying to respond to a change.
- Transient response characteristics: How quickly a system responds to an input.
- Formulating the Problem
- What's the input, what's the control variable, what's the feedback mechanism?
- Control variable = Heap resize ratio
- Measurement variable = Short-term GC overhead(ratio of GC pause time to time since last collection)
- Can use others as well, but not done in paper.
- Finds median overhead for past 5 collections. Dampens sensitivity and oscillation.
1.1.5 Designing a Heap Size Controller
- Chose to treat entire GC system as black box, tune using Proportional Integral Derivative controller
- Use a target GC overhead to resize heap
- Only consider resizing after GC to avoid confounding variables in controller training.
- PID Controller
- Why PID is appropriate
- Doesn't require a model of the system.
- Promises eventual zero steady-state error
- Takes history into account.
- PID Controller Theory
- PID takes in responsiveness configuration, responds by outputting a change or "gain" in the controller
- Implementation
- Built on Jikes/MMTK
- Uses bytes allocated as time proxy
- Heap growth manager was modified to use the PID controller
- Source: http://sourceforge.net/p/jikesrvm/research-archive/40/
- Tuning:
- Can use the "empirical tuning method" which is effective, but dangerous in physical engineering.
- Ideal for software tuning
1.1.6 Evauluation
- See paper for charts, results.
- Generally positive
- Might be worrying is that frequent, drastic changes in live data cause frequent, drastic changes in heap size.
1.1.7 Related work
- Heuristic Approaches
- Brecht used Boehm GC. Grows heap by variably, finely-grained amount. Never shrinks heap.
- Most recent work has explicit goal to avoid paging
- Yang requires changes to OS
- Isla Vista system detects risk of paging by detecting allocation stalls
- Grows aggressively until allocation stall detected, and then shrinks aggressively
- Hertz has different VMs communicate relative stall/paging rates to optimize collection of multiple VMs.
- Mathematical Models
- Sun varies size of heaps of multiple applications to hit performance goals
- Tay and Zong use number of page faults to direct resizing strategy to reduce number of faults.
- Threshold values determined by benchmarking, requires new derivation on a new system or new system behavior.
- Venegrov determines time not spent in GC for hotspot. Uses a study of the hotspot system to find custom tuning algorithm.
- Control Theory Papers
- Storm deals with database configuration, uses control theory to handle ratio and size of sub-heaps for specific types of cached assets in database
- Gandhi uses control theory to optimize apache's CPU and memory utilization
- Growing research area
Created: 2014-10-22 Wed 16:56
Emacs 24.4.1 (Org mode 8.2.10)
Validate
No comments:
Post a Comment