GC

GC Flags

Prints all available GC flags:

-XX:+PrintFlagsFinal

Don’t JIT huge methods: 

Methods that have more than 2500 lines are considered are huge method.

Impact: Long GC Pauses

-XX:-DontCompileHugeMethods

CMS Steps:

  1. STW Initial Mark
  2. Concurrent Mark
  3. Concurrent Preclean
  4. STW Remark
  5. Concurrent Sweep
  6. Concurrent Reset

CMS Flags:

-XX:+UseConcMarkSweepGC

Default on: -XX:+CMSParallelRemarkEnabled

Default on: -XX:+UseParNewGC

Default on: -XX:+CMSConcurrentMTEnabled

-XX:CMSInitiatingOccupancyFraction=70

-XX+UseCMSInitiatingOccupancyOnly

-XX:+CMSClassUnloadingEnabled

(< 1.8) -XX:+CMSPermGenSweepingEnabled

-XX:+ExplicitGCInvokesConcurrent or  -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses

Trigger minor collection before Remark Phase in CMS:(off by default)

Impact is Remark phase might be longer. Remember Remark phase is Stop The World.

-XX:+CMSScavengeBeforeRemark

Ref: http://blog.sokolenko.me/2014/11/javavm-options-production.html