JAVA 调优参数(CMS VS G1)

Concurrent Mark Sweep (CMS) Collector

          it is designed for applications that prefer shorter garbage collection pauses and that can afford to share processor resources with the garbage collector while the application is running.

Table 8-1, "Command-Line Options for i-cms" list command-line options that control the i-cms mode. The section Recommended Options suggests an initial set of options.

Table 8-1 Command-Line Options for i-cms

Option Description Default Value, Java SE 5 and Earlier Default Value, Java SE 6 and Later

-XX:+CMSIncrementalMode

Enables incremental mode. Note that the CMS collector must also be enabled (with -XX:+UseConcMarkSweepGC) for this option to work.

disabled

disabled

-XX:+CMSIncrementalPacing

Enables automatic pacing. The incremental mode duty cycle is automatically adjusted based on statistics collected while the JVM is running.

disabled

disabled

-XX:CMSIncrementalDutyCycle=<N>

The percentage (0 to 100) of time between minor collections that the CMS collector is allowed to run. If CMSIncrementalPacing is enabled, then this is just the initial value.

50

10

-XX:CMSIncrementalDutyCycleMin=<N>

The percentage (0 to 100) that is the lower bound on the duty cycle when CMSIncrementalPacing is enabled.

10

0

-XX:CMSIncrementalSafetyFactor=<N>

The percentage (0 to 100) used to add conservatism when computing the duty cycle

10

10

-XX:CMSIncrementalOffset=<N>

The percentage (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections.

0

0

-XX:CMSExpAvgFactor=<N>

The percentage (0 to 100) used to weight the current sample when computing exponential averages for the CMS collection statistics.

25

25

Recommended Options

To use i-cms in Java SE 8, use the following command-line options:

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode \
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps

The first two options enable the CMS collector and i-cms, respectively. The last two options are not required; they simply cause diagnostic information about garbage collection to be written to standard output, so that garbage collection behavior can be seen and later analyzed.

For Java SE 5 and earlier releases, Oracle recommends using the following as an initial set of command-line options for i-cms:

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode \
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps \
-XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=10

The same values are recommended for JavaSE8 although the values for the three options that control i-cms automatic pacing became the default in JavaSE6.

G1 Collector

     The G1 collector achieves high performance and pause time goals through several techniques.G1 is planned as the long term replacement for the Concurrent Mark-Sweep Collector (CMS).

猜你喜欢

转载自liuyijie2007.iteye.com/blog/2391726
今日推荐