对于JVM设置,可以查考如下配置example:
# Memory configuration
JAVA_OPTS="-server" JAVA_OPTS="$JAVA_OPTS -Xms1280m"
JAVA_OPTS="$JAVA_OPTS -Xmx1280m"
JAVA_OPTS="$JAVA_OPTS -XX:NewSize=640m"
JAVA_OPTS="$JAVA_OPTS -XX:MaxNewSize=640m"
JAVA_OPTS="$JAVA_OPTS -XX:SurvivorRatio=5"
JAVA_OPTS="$JAVA_OPTS -XX:TargetSurvivorRatio=90"
JAVA_OPTS="$JAVA_OPTS -XX:MaxTenuringThreshold=12"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSIncrementalMode"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSIncrementalPacing"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:PermSize=64m"
JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=64m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseTLAB"
# Enable class unloading (needed with ConcMarkSweepGC
JAVA_OPTS="$JAVA_OPTS -XX:+CMSClassUnloadingEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSPermGenSweepingEnabled"
# debug and memory tweaks to avoid Hotspot Compiler Failure
JAVA_OPTS="$JAVA_OPTS -XX:+PrintCompilation"
JAVA_OPTS="$JAVA_OPTS -XX:CodeCacheMinimumFreeSpace=2M"
JAVA_OPTS="$JAVA_OPTS -XX:ReservedCodeCacheSize=64M"
JAVA_OPTS="$JAVA_OPTS -XX:CompileCommandFile=/my/portal/bin/hotspot_compiler"
# Enable JMX Remote Monitoring
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9000" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.password.file=/my/portal/bin/jmxremote.password"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.access.file=/my/portal/bin/jmxremote.access"
# turn on some debug for GC only print the distribution when doing tuning
JAVA_OPTS="$JAVA_OPTS -verbose:gc"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution"
JAVA_OPTS="$JAVA_OPTS -Xloggc:/my/portal/logs/portal/gc.log"
# Enable remote debugging port
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"