Usage:
Sets a percentage to shift to the incremental mode duty cycle to the right during a minor Garbage Collector (GC). It has this following syntax:-XX:CMSIncrementalOffset=offset, where offset is the percentage between 0 and 100
Since:
Starting from JDK 6.
Examples:
This will set a shift percentage of 50%:
java -XX:CMSIncrementalOffset=50 MainClass
Description:
Before talking about the flag, we need to introduce Garbage Collector (GC) and Concurrent Mark Sweep (CMS):
Garbage Collector is a way of the JVM to clean the memory and makes the java memory more efficient. It tracks (Mark step) and removes (sweep step) every unused object available in the JVM heap space. An object is considered unused when it’s referenced by null, assigned to another reference or by anonymous object …. There are 5 type of GC implementations:
- Serial Garbage Collector
- Parallel Garbage Collector
- CMS Garbage Collector
- G1 Garbage Collector
- Z Garbage Collector
CMS Garbage Collector, as mentioned above, is one of the implementations of GC, which uses multiple thread for garbage collection. It’s created for applications that favor shorter garbage collection pauses and that can afford to share processor resources with the garbage collector while the application is running. It achieves long pauses by two ways:
- By using free lists to manage reclaimed space instead of compacting the Old Generation.
- By doing mainly the job in Mark (marking a reference) and Sweep (removing the marked reference) process simultaneously with the application. Which means that the GC is not stopping or freezing the application’s threads to do its job. But it does take part of using the CPU time with the application. By default, GC algorithm can use number of threads up to ¼ of the number of physical cores of your machine.
Hence, the concurrent garbage collector has a safety factor which is added to the duty cycle when it decides how to pace the collection. This flag allows you to set the percentage of time (0 to 100) used to add conservatism when computing the duty cycle. Setting a large number means that more time will be given to a minor collection.
The incremental mode is a mode which is main objective is to reduce the effects of long concurrent phases by regularly shutting down the concurrent phase to return the processor to the main application.
The flag “CMSIncrementalOffset” allows you to set a minimum number of cycles to shift the use to an incremental mode duty to the right during a minor Garbage Collector (GC).
Default Value:
By default, this flag is disabled.
Arguments related:
CMSInitiatingOccupancyFraction, CMSScavengeBeforeRemark, CMSClassUnloadingEnabled, CMSScavengeBeforeRemark, CMSIncrementalSafetyFactor, UseCMSInitiatingOccupancyOnly, CMSPermGenSweepingEnabled, UseConcMarkSweepGC, CMSIncrementalMode, CMSIncrementalDutyCycle, CMSIncrementalDutySafetyFactor, CMSIncrementalPacing, CMSTriggerRatio and CMSIncrementalDutyCycleMin
Related Posts:
Edit your Comment