...
Break down of Configuration
...
# Use the Hot Spot server compiler
-server
# Set the initial & max heap size to the same value. This makes monitoring heap usage a bit easier
-Xms1280m
-Xmx1280m
# Set the NewSize and MaxNewSize (space for eden and survior) to half of the max heap. DO NOT set this to more than half of the max heap or the GC can't fulfill the Young Generation Guarantee which will cause constant full GCs
-XX:NewSize=640m
...
...
-XX:MaxNewSize=640m
...
...
-XX:SurvivorRatio=5
...
...
-XX:TargetSurvivorRatio=90
...
...
-XX:MaxTenuringThreshold=12
...
...
-XX:+UseConcMarkSweepGC
...
...
-XX:+CMSIncrementalMode
...
...
-XX:+CMSIncrementalPacing
...
...
-XX:+CMSParallelRemarkEnabled
...
...
-XX:+UseParNewGC
...
...
-XX:PermSize=64m
...
...
-XX:MaxPermSize=64m
...
...
-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
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"