Title: Aspect Enabled Adaptive Garbage Collection
1Aspect Enabled Adaptive Garbage Collection
2Outline
- Introduction
- Problem Java Performance
- Jikes Research Virtual Machine (RVM)
- Aspect Oriented Programming (AOP)
- Aspectual Framework for Adaptive Garbage
Collection - SPEC JVM98 Results
- Summary
- Future Work
3Thesis Overview
- Goal
- To explore the use of aspect oriented
programming (AOP) software engineering to enhance
the run-time performance of the Java language. - More specifically, an AOP framework was created
to enable adaptive garbage collection in the
Jikes Research Virtual Machine (RVM).
4Thesis Contribution
- Detailed how aspects in the form of AspectJ can
be integrated into the Jikes RVM for
environmentally aware software components. - Described an AOP framework for adaptive Garbage
Collection in the Jikes RVM to improve Java
application performance. - Explained how the current AOP framework can be
expanded for future software research.
5Problem Java Performance
- Java is an interpreted programming language.
- A virtual machine (VM) translates Java byte-code
into machine code. - A virtual machine also automatically manages heap
memory.
6Java Performance Cont.
- The use of a VM consumes CPU cycles and slows
down the execution of the Java application. - New Java technology is continually being
developed to increase the performance of the
language. - Just-in-time Compilation
- New Garbage Collection Schemes
7Garbage Collector Categories
- Stop the World Application program is paused
while the garbage collector is active. - Incremental Interleaves partial garbage
collection with application execution. - Concurrent Application and collector may
operate simultaneously - Real-Time Garbage collection time is bounded by
a guaranteed small time constant to minimize the
application pause time.
8Garbage Collection Terms
- Garbage Collection Cycle (2 phases)
- 1) Garbage Detection
- 2) Garbage Reclamation
- Root Set
- Static variables
- Local (stack-allocated) variables
- General-purpose registers.
- All objects reachable from the root set are
consider live and cannot be reclaimed.
Un-reachable objects can be freed.
9STW Semi-Space
10STW Semi-Space
- Advantages
- Inherently compacts data during copying.
- Disadvantages
- Requires a lot more heap memory!
11STW Mark-Sweep
12STW Mark-Sweep
- Advantages
- Simple implementation
- Handles cyclical garbage
- Disadvantages
- Fragmentation of memory
- Garbage collection time is proportional to heap
size
13STW Generational Copy
14STW Generational Mark-Sweep
15STW Generational
- Advantage
- Reduced garbage collection overhead
- Disadvantage
- More book keeping overhead to keep track of
references from the mature space to the nursery
(Write Barriers)
16Garbage Collector Selection
- There is no single garbage collector that will be
optimal in all situations. - Current VMs garbage collectors are static
entities that are included at VM compile time or
selected via a user command line switch. - Lack of environmental awareness results in a
non-optimal garbage collector choice.
17Aspect Oriented Programming
- AOP can be used to overcome the performance
limitations of a static garbage collector. - Aspects allow monolithic program components to be
non-intrusively upgraded and modified to achieve
new functionality. - Aspects permit the gathering of data throughout
a programs hierarchy.
18AspectJ
- Join Point - A well defined location within the
primary code where a concern will crosscut the
application. - Pointcut - A collection of join points that
designates where advice code should be inserted
in the program. - Advice - Code to execute before, after, or around
a pointcut encounter.
19Adaptive Garbage Collector
- Adopts a best-fit approach to garbage
collection by adjusting itself to better suit the
run-time environment. - In their paper, Suman et al. showed how adaptive
garbage collection can benefit the performance of
Java applications. - Adaptive garbage collection can be used for other
purposes besides performance.
20Why Use AOP?
- Aspects minimize the required changes to the RVM
source code though the use of inter-type
declarations and the aspectual introduction. - Aspects can crosscut the RVM hierarchy to gather
related VM statistics. - Aspects allow for non-intrusive plugging and
unplugging of VM components to update
functionality. - Aspects modularize the adaptive garbage collector
behavior so future upgrades require minimal
effort.
21Jikes Research Virtual Machine
22Java Virtual Memory Toolkit
- From version 2.2.0 of the Jikes RVM, the garbage
collector is contained within the Java Memory
Tookit - The core VM is isolated from any memory
management responsibilities and allows different
garbage collectors to be compared on a 11 basis.
23Java Virtual Memory Toolkit
- The garbage collector in the JMTk is composed
from multiple highly reusable classes. - All garbage collectors are of the Stop the World
variety. - The unique characteristics of a garbage collector
is derived from its Plan and associated
policies classes.
24Aspectual Framework
- Extract all used garbage collector methods and
re-target them with aspects. - Introduce new garbage collection schemes into the
singular JMTk garbage collection plan with
aspects. - Resolve all memory map conflicts between
co-existing garbage collectors. - Create a heuristic for garbage collector
selection.
25Aspectual Framework
26Jikes RVM Virtual Memory Map
27Universal Virtual Memory Map
- The universal virtual memory map helps resolve
resource conflicts between the JMTk garbage
collectors. - Semi-Space
- Generational Copy
28Limitations/Overhead of AspectJ
- AOP has an inherent overhead associated with
pointcut matching and advice execution. - In the Jikes RVM, writeBarriers are needlessly
called on non-generational garbage collectors - Final Variables not targetable.
- Protected Access Types are not supported
- Non Intuitive Pointcuts for abstract methods.
29SPEC JVM 98 Benchmarks
- Compress
- Uses a modified Lempel-Ziv method (LZW) to
compress data. - Jess
- Java Expert Shell System that continuously
applies a set of if-then statements, called
rules, to a set of data, called the fact list. - Db
- Performs multiple database functions on a memory
resident database. - Javac
- Java compiler from the JDK 1.0.2.
30SPEC JVM 98 Benchmarks
- Mpegaudio
- Decompresses audio files that conform to the ISO
MPEG Layer-3 audio specification. - Mtrt
- A raytracer that works on a scene depicting a
dinosaur, where two threads each renders the
scene in the input file time-test model . - Jack
- A Java parser generator that is based on the
Purdue Compiler Construction Tool Set (PCCTS).
31Computer/Experiment Setup
- A computer with the following characteristics was
used to produce the experimental results. - 2.0 Ghz Intel Xeon Processor
- 1 GB DDR 266 system memory
- RedHat 9.0 Linux OS (standard installation)
- All JVM98 benchmarks were executed 5 times on a
100 sized dataset for each heap size. The
fastest and slowest times are discarded and the
remaining 3 are averaged.
32Jikes RVM Setup
- Fast
- Assertion checking in the RVM is turned o.
- All necessary RVM classes are included in the
boot image. - Adaptive
- The adaptive optimizing compiler selects
"hot-spots" during a programs execution via a
statistical sampling model. As such, every run of
the Jikes RVM with the adaptive compiler will
produce slightly differing results.
33JVM98 Benchmark Min Heap Sizes
- The Generational Mark Sweep collector has the
lowest memory heap requirements of all evaluated
garbage collectors
34JVM98 Standardized Heap Sizes
- In order to ensure a fair comparison between all
garbage collectors, the minimum heap size was
standardized to be the largest of the minimum
values for the four garbage collectors.
35SPEC JVM98 Jess Results
36Jess Garbage Collection Count
37Jess Results
38SPEC JVM98 Db Results
39Db Garbage Collection Count
40Db Garbage Collection Count
41SPEC JVM98 Javac Results
42Javac Garbage Collection Count
43Javac Results
44Summary
- Described how to increase the performance of Java
applications with the use of AOP. - Defined and created an AOP framework to
facilitate an adaptive garbage collector and
implemented it in the Jikes RVM. - Discovered that our AOP framework introduces a
slight performance overhead but can increase the
JVM98 benchmark performance on the Jikes RVM
significantly.
45Future Work
- Our AOP framework does not currently support
on-the-fly garbage collector switching.
However, the framework can be upgraded to do so.