Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kapkaev/e8f179d05ed8299f3e792ad055fdf3ac to your computer and use it in GitHub Desktop.
Save kapkaev/e8f179d05ed8299f3e792ad055fdf3ac to your computer and use it in GitHub Desktop.
JVM options to maximize performance
# See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html
# See https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html
# See https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm
# See http://normanmaurer.me/blog_in_progress/2013/11/07/Inline-all-the-Things/
# See http://stas-blogspot.blogspot.com.br/2011/07/most-complete-list-of-xx-options-for.html
# -XX:+LogCompilation
# -XX:+PrintInlining
-Dfile.encoding=UTF-8
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.opengl=true
-Dsun.java2d.d3d=false
-Djava.net.preferIPv4Stack=true
-server
-Xverify:none
-Xms600m # ignored when UseLargePages is active
-Xmx600m # Should be less than 4 GB or at least equal or less than ~26 G. See 'Zero-Based Compressed Ordinary Object Pointers'
-XX:MetaspaceSize=200m
-XX:MaxMetaspaceSize=200m
-XX:MinMetaspaceFreeRatio=0
-XX:MaxMetaspaceFreeRatio=100
-XX:ReservedCodeCacheSize=350M
-XX:+AlwaysPreTouch
# See http://www.dataforte.net/blog/2010/03/12/java-and-large-memory-pages-on-linux/
# See http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html
# https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
# Online calculator: http://www.peuss.de/node/67
-XX:+UseLargePages
# grep -i huge /proc/meminfo
# See http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/G1GettingStarted/index.html
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:GCPauseIntervalMillis=8000
-XX:+UnlockExperimentalVMOptions
# Default is 5
-XX:G1NewSizePercent=10
# Default is 60
-XX:G1MaxNewSizePercent=80
# Decrease if gc.log has 'to-space exhausted' (default is 45)
#-XX:InitiatingHeapOccupancyPercent=30
# Increase if gc.log has 'concurrent humongous allocation'
-XX:G1HeapRegionSize=12m
# -XX:ConcGCThreads=8
-XX:+UseStringDeduplication
-XX:StringDeduplicationAgeThreshold=3
-XX:+AggressiveOpts
-XX:MaxTrivialSize=12
-XX:MaxInlineSize=270
-XX:InlineSmallCode=2000
-XX:+UnlockDiagnosticVMOptions
-XX:+PrintCommandLineFlags
-XX:+PrintFlagsFinal
# See http://javajee.com/string-interning-and-performance-tuning-in-java
-XX:+PrintStringTableStatistics
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=java_pid.hprof
-Xloggc:gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=1048576
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintStringDeduplicationStatistics
-XX:+G1PrintRegionLivenessInfo
-XX:+G1SummarizeConcMark
-XX:+G1SummarizeRSetStats
-XX:+PrintAdaptiveSizePolicy
-XX:+PrintTenuringDistribution
-XX:+G1TraceConcRefinement
-XX:+TraceGCTaskThread
# Enable if you want to debug
# -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787
# Java Additional Parameters
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Djava.net.preferIPv4Stack=true
wrapper.java.additional.3=-Dsun.rmi.dgc.client.gcInterval=3600000
wrapper.java.additional.4=-Dsun.rmi.dgc.server.gcInterval=3600000
wrapper.java.additional.5=-server
wrapper.java.additional.6=%JBOSS_MEMORY_XMS%
wrapper.java.additional.7=%JBOSS_MEMORY_XMX%
wrapper.java.additional.8=%JBOSS_MEMORY_XSS%
wrapper.java.additional.9=-XX:MetaspaceSize=256m
wrapper.java.additional.10=%JBOSS_MEMORY_MAXPERMSIZE%
wrapper.java.additional.11=-XX:MinMetaspaceFreeRatio=0
wrapper.java.additional.12=-XX:MaxMetaspaceFreeRatio=100
wrapper.java.additional.20=-XX:+UseG1GC
wrapper.java.additional.21=-XX:MaxGCPauseMillis=300
wrapper.java.additional.22=-XX:GCPauseIntervalMillis=8000
wrapper.java.additional.23=-XX:+UseStringDeduplication
wrapper.java.additional.24=-XX:StringDeduplicationAgeThreshold=3
wrapper.java.additional.30=-XX:+AggressiveOpts
wrapper.java.additional.31=-XX:MaxTrivialSize=12
wrapper.java.additional.32=-XX:MaxInlineSize=270
wrapper.java.additional.33=-XX:InlineSmallCode=2000
wrapper.java.additional.40=-Dcom.sun.management.jmxremote
wrapper.java.additional.41=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.42=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.43=-Dcom.sun.management.jmxremote.port=%JMXREMOTE_PORT%
wrapper.java.additional.44=-Djava.rmi.server.hostname=%SELF_IP%
wrapper.java.additional.45=-Djboss.platform.mbeanserver
wrapper.java.additional.46=-Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
wrapper.java.additional.47=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.DISABLED=false
wrapper.java.additional.60=-XX:+UnlockDiagnosticVMOptions
wrapper.java.additional.61=-XX:+PrintFlagsFinal
wrapper.java.additional.62=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.63=-XX:HeapDumpPath=%JBOSS_LOGS%/java_pid.hprof
wrapper.java.additional.64=-Xloggc:%JBOSS_LOGS%/gc.log
wrapper.java.additional.65=-XX:+PrintGCDetails
wrapper.java.additional.66=-XX:+PrintGCDateStamps
wrapper.java.additional.67=-XX:+PrintGCTimeStamps
# wrapper.java.additional.68=-XX:+PrintStringDeduplicationStatistics
wrapper.java.additional.69=-XX:+G1PrintRegionLivenessInfo
wrapper.java.additional.70=-XX:+G1SummarizeConcMark
wrapper.java.additional.71=-XX:+G1SummarizeRSetStats
wrapper.java.additional.72=-XX:+PrintAdaptiveSizePolicy
wrapper.java.additional.73=-XX:+PrintTenuringDistribution
wrapper.java.additional.74=-XX:+G1TraceConcRefinement
wrapper.java.additional.75=-XX:+TraceGCTaskThread
wrapper.java.additional.90=%JBOSS_REMOTE_DEBUG%
wrapper.java.additional.100=-Dprogram.name=run-wrapper.sh
wrapper.java.additional.101=-Dorg.jboss.resolver.warning=true
wrapper.java.additional.102=-Dsun.lang.ClassLoader.allowArraySyntax=true
wrapper.java.additional.103=-Djboss.server.log.dir=%JBOSS_LOGS%
wrapper.java.additional.104=-Djboss.partition.name=%JBOSS_PARTITION_NAME%
wrapper.java.additional.105=-Djava.endorsed.dirs=%JBOSS_HOME%/lib/endorsed
wrapper.java.additional.106=-D{{c["jboss.service.binding.set"]}}
wrapper.java.additional.107=-Dm2-repo=%M2_REPO%
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.jboss.Main
wrapper.app.parameter.2=-b
wrapper.app.parameter.3=0.0.0.0
wrapper.app.parameter.4=-c
wrapper.app.parameter.5=%JBOSS_INSTANCE_NAME%
export LANG="pt_BR.UTF-8"
export DISABLE_JSW=""
export JBOSS_INSTANCE_NAME="JB1-ENV1"
export SERVERGROUP_NAME=${JBOSS_INSTANCE_NAME#*[-_]}
export JAVA_HOME="/opt/jdk-8"
export JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss-4.2.2.GA-jdk6"}
export JBOSS_INSTANCE_HOME="$JBOSS_HOME/server/$JBOSS_INSTANCE_NAME"
export M2_REPO="/opt/shared-libs"
export JBOSS_USER=${JBOSS_USER:-"jboss"}
export APP_GROUP=$(id -ng $JBOSS_USER)
export SELF_IP="$(hostname -i)"
export JBOSS_LOGS="/var/logs/$JBOSS_INSTANCE_NAME/system"
export JBOSS_PARTITION_NAME=${JBOSS_PARTITION_NAME:-"partition-env1"}
export JMXREMOTE_PORT=23418
export JBOSS_MEMORY_XMS=-Xms10G
export JBOSS_MEMORY_XMX=-Xmx10G
export JBOSS_MEMORY_XSS=-Xss256k
export JBOSS_MEMORY_MAXPERMSIZE=-XX:MaxPermSize=256m
export JBOSS_REMOTE_DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment