Switching from CMS to G1GC

To move from Concurrent Mark Sweep (CMS) GC to Garbage First (G1) GC, you must update the HADOOP_NAMENODE_OPTS settings in hadoop-env.sh.

On the Ambari dashboard, select HDFS > Configs > Advanced > Advanced hadoop-env.
Make the following changes to the HADOOP_NAMENODE_OPTS settings:
  • Replace -XX:+UseConcMarkSweepGC with -XX:+UseG1GC
  • Remove -XX:+UseCMSInitiatingOccupancyOnly and -XX:CMSInitiatingOccupancyFraction=####
  • Remove -XX:NewSize=#### and -XX:MaxNewSize=####
  • (Optional) Add -XX:MaxGCPauseMillis=####
  • (Optional) Add -XX:InitiatingHeapOccupancyPercent=####
  • (Optional) Add -XX:ParallelGCThreads=####, if not present.

    The default value of this parameter is set to the number of logical processors (up to a value of 8). For more than eight logical processors, the default value is set to 5/8th the number of logical processors.