Title: Problem Statement
1Problem Statement
- Out of Memory Conditions and performance issues
caused by the increased creation of very large
objects ( 1MB to 100 MB ) in current Java
(often XML-generating) applications. - Large Objects are defined in the VM
implementation as those gt 64 KB in size. In
practice, the worst case symptoms are typically
triggered by objects of 10 MB in size, or groups
of allocations of 1 MB in size - Worst case - Out of Memory failures despite
increasingly large heap sizes and repeated full
compactions - Bad case - Poor throughput, premature and
frequent and long GC pauses. Early AF GC cycles
associated with large objects
2The Mark-Sweep-Compaction Algorithm
3Garbage Collection
Heap fragmentation is a normal consequence of a
flat heap mark-sweep-(compact) garbage collector
Garbage Collection is conservative some
fragmentation of the heap occurs as not all
objects can be relocated during compaction The
normal alleviation for fragmentation is the
compaction phase of the garbage collector.
However, full compactions are very intrusive with
large pause times. Compaction avoidance can be
achieved by proper object placement in the heap
4Heap Fragmentation
- Heap Fragmentation occurs through the course of
normal program execution. New objects are
allocated, and unreferenced objects are freed
such that free blocks of heap memory are left in
between blocks occupied by live objects. This
leaves not enough contiguous free heap space
available into which the object will fit.
Pinned object
Deallocated space
Normal object
5The Java Heap Layout
Heap Top
Heap Limit
Xmx
Wilderness
Free list
Active area of heap
Heap Base
6Wilderness aka LOA (Large Object Area)
Object gt 64 K (first try main heap, if free
space not available allocate in LOA (wilderness)
Wilderness allocated at end of active heap (
initial size 5 of active heap)
Active Heap
Object lt 64K allocated in the free list of the
main heap
Object lt 512 bytes allocated in the TLH (Thread
Local Heap)
7 The Idea
Object Size Frequency of object allocation
Extent of heap usage
Runtime profiling of large object allocation and
determining the usage pattern
1
Calculation of appropriate LOA value based on
predetermined heuristics. The maximum java heap
value recalculated
2
Expand java heap new layout based on
recalculated LOA size.
3
8 In Summary
It is common for java applications today to
create very large objects
The approach to optimal use of LOA can alleviate
Out Of Memory conditions and improve application
performance
The approach has been succesfully tested with
customer applications