Introduction:
A preliminary version of G1 (garbage first) GC has been introduced in Java 6 update 14. This has been further enhanced in Java 7. G1 offers a new dimension to garbage collection in Java. G1 performs whole heap operations concurrently which greatly decreases the pause times and thereby increases the throughput.
Concept:
G1 employs multiple techniuques to achieve lower pauses and higher throughput but the core concept is to partition the heap into smaller equal sized regions and then identifiying which regions can result in maximum yield. That is it does a global mark phase after which it figures out which of the regions have the least live objects i.e. those regions which can result in maximum garbage collection thereby releasing more memory for use.
By choosing the collect memory from regions that least occupied first, it also gives more time to other regions that are occupied to get freed up.
Cost Model:
Since the heap is partitioned into equal sized regions and the occupancy is known during the mark phase, it has a fairly accurate estimate of the cost of collecting a region within a given pause limit. This enables it to meet soft-real time needs at fairly good accuracy. The allowed pause time can be configured by the user depending on the applications thorughput needs, for example the user can specify that for every 200ms spend no more than 50ms on garbage collection. This can be configured using the following options:
-XX:MaxGCPauseMillis =50
-XX:GCPauseIntervalMillis =200
Few other techniques that GC1 employs is the Popular Object Handling. A popular object is one that is referenced from many locations in the heap. A small set of heap regions are reserved for storing popular objects and GC1 tries to quickly identify popular objects and move them to the reserved heap regions. These reserved regions are given the least priority for collection.
To use G1 as the GC following arguments have to passed to jvm:
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
Summary:
GC1 seems to offer very good results for applications that run on mult-processor environments with large memories and have soft-real time requirements. The benchmark results available so far are quite promising and this also the planned long term replacement for Concurrent Mark-Sweep GC.
A preliminary version of G1 (garbage first) GC has been introduced in Java 6 update 14. This has been further enhanced in Java 7. G1 offers a new dimension to garbage collection in Java. G1 performs whole heap operations concurrently which greatly decreases the pause times and thereby increases the throughput.
Concept:
G1 employs multiple techniuques to achieve lower pauses and higher throughput but the core concept is to partition the heap into smaller equal sized regions and then identifiying which regions can result in maximum yield. That is it does a global mark phase after which it figures out which of the regions have the least live objects i.e. those regions which can result in maximum garbage collection thereby releasing more memory for use.
By choosing the collect memory from regions that least occupied first, it also gives more time to other regions that are occupied to get freed up.
Cost Model:
Since the heap is partitioned into equal sized regions and the occupancy is known during the mark phase, it has a fairly accurate estimate of the cost of collecting a region within a given pause limit. This enables it to meet soft-real time needs at fairly good accuracy. The allowed pause time can be configured by the user depending on the applications thorughput needs, for example the user can specify that for every 200ms spend no more than 50ms on garbage collection. This can be configured using the following options:
-XX:MaxGCPauseMillis =50
-XX:GCPauseIntervalMillis =200
Few other techniques that GC1 employs is the Popular Object Handling. A popular object is one that is referenced from many locations in the heap. A small set of heap regions are reserved for storing popular objects and GC1 tries to quickly identify popular objects and move them to the reserved heap regions. These reserved regions are given the least priority for collection.
To use G1 as the GC following arguments have to passed to jvm:
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
Summary:
GC1 seems to offer very good results for applications that run on mult-processor environments with large memories and have soft-real time requirements. The benchmark results available so far are quite promising and this also the planned long term replacement for Concurrent Mark-Sweep GC.
No comments:
Post a Comment