java8启动脚本

 java8应用启动脚本:

采用cms gc

-javaagent:/app/apm-agent/skywalking-agent.jar -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Xmx2g -Xms2g -Xmn256m -XX:MetaspaceSize=256m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.password.file=/app/deploy/bin/jmxremote.password

## cms

-server -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Xmx2g -Xms2g -Xmn256m -XX:MetaspaceSize=256m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70

## G1

-server -Xmx4G -Xms4G -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=512M -XX:+UseG1GC
-XX:MaxGCPauseMillis=100 -XX:+ParallelRefProcEnabled -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true

 java7内存CPU备份:


-server -Xmx2g -Xms2g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70

java8内存GC配置:

JAVA_OPTS="-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
JAVA_MEM_OPTS="-server -Xmx4G -Xms4G -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=512M -XX:+UseG1GC
-XX:MaxGCPauseMillis=100 -XX:+ParallelRefProcEnabled"


#!/bin/bash
cd `dirname $0`
cd ..
DEPLOY_DIR=`pwd`
JAR_NAME=$DEPLOY_DIR/lib/foobar.jar
JAVA_OPTS="-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
if [ -z "$JAVA_MEM_OPTS" ];then
  JAVA_MEM_OPTS="-server -Xmx4G -Xms4G -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=512M -XX:+UseG1GC
-XX:MaxGCPauseMillis=100 -XX:+ParallelRefProcEnabled"
fi
if [ -z "$JAVA_JMX_OPTS" ];then
  JAVA_JMX_OPTS="-Dcom.sun.management.jmxremote
          -Dcom.sun.management.jmxremote.port=1099
          -Dcom.sun.management.jmxremote.rmi.port=1099
          -Dcom.sun.management.jmxremote.ssl=false
          -Dcom.sun.management.jmxremote.authenticate=false"
fi
if [ -z "$JAVA_OOM_OPTS" ];then
  JAVA_OOM_OPTS="-XX:ErrorFile=$DEPLOY_DIR/logs/hs_err_pid%p.log
          -XX:HeapDumpPath=$DEPLOY_DIR/logs/
          -XX:+HeapDumpOnOutOfMemoryError"
fi

nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_JMX_OPTS $JAVA_OOM_OPTS \
          -jar $JAR_NAME \
          --spring.profiles.active=$SPRING_PROFILES_ACTIVE >/dev/null 2>&1 &

你可能感兴趣的:(java,服务器,前端)