修改hadoop-env.sh添加
vi $HADOOP_HOME/conf/hadoop-env.sh export HADOOP_NAMENODE_OPTS="-Xmx16384m -Xms4096m -Xmn2048m -verbose:gc -Xloggc:/usr/local/fqlhadoop/logs/hdfs/namenode.gc.log -XX:ErrorFile=/usr/local/fqlhadoop/logs/hdfs/hs_err_pid.log -XX:+UseParNewGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=85 -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:SurvivorRatio=4 -XX:CMSMaxAbortablePrecleanTime=1000 -XX:+CMSClassUnloadingEnabled -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote $HADOOP_NAMENODE_OPTS"
export HADOOP_DATANODE_OPTS="-Xms2048m -Xmx2048m -Dcom.sun.management.jmxremote ${HADOOP_DATANODE_OPTS}"
export YARN_RESOURCEMANAGER_OPTS="-Xms2048m -Xmx2048m -Dcom.sun.management.jmxremote ${YARN_RESOURCEMANAGER_OPTS}"
|
重要参数说明:
-XX:+UseParNewGC 设置年轻代为并行收集 -XX:+UseConcMarkSweepGC 使用CMS内存收集 -XX:CMSFullGCsBeforeCompaction 多少次后进行内存压缩 -XX:CMSInitiatingPermOccupancyFraction 设置Perm Gen使用到达多少比率时触发 -XX+UseCMSCompactAtFullCollection 在FULL GC的时候, 对年老代的压缩 -XX:SurvivorRatio Eden区与Survivor区的大小比值 -XX:+DisableExplicitGC 关闭System.gc()
-Xmx16384m 可使用最大堆内存 -Xms4096m 初始堆内存 -Xmn2048m 年轻代内存 |