Download presentation
Presentation is loading. Please wait.
Published byHope Horn Modified over 9 years ago
1
G1 TUNING Shubham Modi(10327729) Ujjwal Kumar Singh(10772) Vaibhav(10780)
2
Motivation There is memory sensitive application which is running and now a new object has to be created. Suppose that the memory heap has insufficient space for the newly created objects. Such conditions would trigger a full garbage collection cycle, which will perform compaction of the heap. With CMS GC, the full collection is serial and STW, hence your application threads are stopped for the entire duration while the heap space is reclaimed and then compacted. This affects the performance of the application and will decrease the responsiveness and throughput.
3
G1 Garbage Collector G1 is a compacting collector i.e. it compacts sufficiently to completely avoid the use of fine-grained free lists for allocation, and instead relies on regions. The heap is partitioned into a set of equal-sized heap regions, each a contiguous range of virtual memory providing greater flexibility in memory usage. [6]
4
How G1 works? Heap is split into many fixed size region ranging from 1 to 32 Mb [6]
5
This is a STW pause. Eden and Survivor size is calculated for the next GC. GC Pause time is taken into consideration. Regions are mapped into Eden, Survivor and Old generation [6]
6
Live objects have been evacuated to survivor regions or to old generation regions Liveness of regions is calculated and empty regions are marked X and are deleted in remark phase [6]
7
After calculating liveness of regions G1 selects the region with least liveness and collects it. Both young and old generation are collected at the same time. After it we get compacted dark blue and dark green regions [6]
8
Why G1? Provide predictable GC pause duration Decrease frequency of Stop The World(Full GC Cycle) Compact free space without lengthy GC induced pause times Do not require much larger Java heap space Do not sacrifices throughput of application Compaction mostly eliminating the fragmentation issues
9
Objectives Improves responsiveness Increase throughput
10
Problem When we try to create 10 million children of root, it gives OutofHeap Error We created first tree with root and 5 million children occupying ~ 55% of heap space Then we made child1 as root of tree Therefore all other nodes becomes unreachable Then we created another tree with a root and its 5 million children Hence Garbage collector is called to free the space causing Stop The World event to occur root Child 5million child3child2 child1 ………
11
Factors affecting G1 Performance GC Pause Time: Set the target for the maximum GC pause time(soft goal) Heap Occupancy: Percentage of the entire heap occupancy to start the concurrent GC cycle(Default 45) Old Generation size: New to Old Generation size ratio(Default 2) Heap region size: Size of the single region of uniformly divided space(Min 1 and Max 32Mb)
12
Results Here we achieved high responsiveness with average GC pause time as 0.010 sec which is normally 0.1 sec Grey region shows concurrent GC pauses of an application Dark grey region shows Stop The World event Here we achieved high throughput 35% which is normally 25-27% in other cases. As shown in this case we skipped Stop The World event
13
Tools used Eclipse for generating Tree GCViewer to get plots and other details of G1 performance like throughput etc.
14
References [ 1 ] Domani, Tamar, Elliot K. Kolodner, and Erez Petrank. "A generational on- the-y garbage collector for Java." ACM SIGPLAN Notices. Vol. 35. No. 5. ACM, 2000. [ 2 ] www.cubrid.org/blog/dev-platform/understanding-java-garbage- collection [ 3 ] www.ibm.com/developerworks/library/j-leaks [ 4 ] www.cubrid.org/blog/textyle/428187 [ 5 ] www.infoq.com/articles/JavaGarbageCollectionDistilled [ 6 ] www.oracle.com/webfolder/technetwork/tutorials/obe/java/G1GettingStart ed/index.html [ 7 ] github.com/chewiebug/GCViewer/blob/master/README
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.