Balanced GC aims to provide short and constant pause times even for large Java heaps over 20GB. It divides the heap into fixed size regions grouped into generations. Partial garbage collections (PGCs) occur when the Eden space is full and shift live objects to older generations using copy forward or mark compact. A global mark phase (GMP) identifies regions for PGCs to collect from and builds live object data for PGCs to use, allowing some marking to occur concurrently. Verbose GC logging and visualization tools can monitor Balanced GC execution.
1 of 11
Downloaded 10 times
More Related Content
J9 Balanced GC
1. Balanced GC Why, What & How
Parameswaran Selvam
IBM Runtimes J9 VM
J9 VM Knowledge Sharing Session
2. Balanced GC
則 WHY?
Application Pause Time increases as Java Heap size increases with existing GC
policies
Applications with Heap sizes > 20 GB are common
A GC policy with short & constant Pause time, though not guaranteed
2
512 1024 4096 8192
0
0.5
1
1.5
2
2.5
Reality
Expected
Heap Size
PauseTime
3. Balanced GC
則 WHAT is?
Heap Layout
Region based GC method
Divides Java Heap into fixed size regions
Regions grouped/named into max 24 generations
New Objects allocated/stored in regions tagged as 0th
generation/Age 0 or
Eden space
Java Heap : Regions belong to different generations set
3
4. Balanced GC
則 WHAT is?
GC Phases
Partial Garbage Collect (PGC)
When Eden space becomes full
Global Mark Phase (GMP)
When reaches certain threshold like free memory, allocation rate
Global GC
When PGC/GMP doesnt yield returns or When application explicitly
invoked
4
5. Balanced GC
則 WHAT is?
Partial Garbage Collect (PGC)
Stop The World(STW) GC execution, hence application threads execution
stopped
Picks up the regions belong/tag to eden space + other regions(which are
identified by GMP as regions contains more dead objects/memory
reclaimed)
2 algorithms/methods used
Copy Forward
Mark & Compact
PGC picks up a method based on heap availability
5
6. Balanced GC
則 WHAT is?
Partial Garbage Collect (PGC) Copy Forward
Same as nursery/scavenger GC in GENCON(Generational Concurrent)
Scans through objects in collection regions set
Shifting the live object to its next generation region promoting the object
Eden full PGC triggered
PGC shifts/moves object
Before PGC
PGC Copy Forward
After PGC
6
7. Balanced GC
則 WHAT is?
Partial Garbage Collect (PGC) Mark Compact
Scans through objects in collection regions set
Mark the live objects in collection set regions
Compact the regions based on their generation set
7
Eden full PGC triggered
PGC Mark Compact
PGC compact
Before PGC
After PGC
8. Balanced GC
則 WHAT is?
Global Mark Phase (GMP)
Stop The World GC operation
Scans through the entire Java heap to build up the live objects data
PGC consumes the live objects data prepared by GMP once GMP
completes
Makes use of idle processor time to do concurrent mark
Next PGC takes up GMP
constructed live objects data
set
8
9. Balanced GC
9
則 How to?
Monitor / Study GC execution
-verbose:gc enables verbose GC and writes data into JVM stderr stream
-Xverbosgclog:<filename> to redirect the output to file
Use Garbage Collection & Memory Visualizer tool to interpret the verbose
GC data