主要是这三个选项的调整需要根据主机的内存配置 以及业务量的使用情况调节 -Xmx4g -Xms4g -Xmn2g
xmx 与xms一般设置为一样 xmn大致设置为xmx xms的三分之一
可以使用jstat -gcutil (pid) 1000 来检查java内存是否需要调整 是否使用快满了!
metaq
vim /usr/local/taobao/metamorphosis-server-wrapper/bin/env.sh
BROKER_JVM_ARGS="-server -Xmx4g -Xms4g -Xmn2g -XX:PermSize=128m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -Dmeta.home=$meta_home -cp $CLASSPATH "
tomcat :
vim /usr/local/tomcat_11/bin/catalina.sh
JAVA_OPTS='-server -Xmx3g -Xms3g -Xmn1g -XX:PermSize=128m -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70'
zookeeper:
vim /usr/local/zookeeper-3.4.5/conf/java.env
#!/bin/sh
export JVMFLAGS="-server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m"
一般应用程序项目:
vim /usr/local/CSPSettleService/bin/start.sh
JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn512m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "