Frequently used Java arguments

Frequently used Java arguments

Language and encoding

1
2
3
-Duser.language=en \
-Duser.country=US \
-Dfile.encoding=UTF-8 \

Memory

1
2
3
4
5
6
7
8
-Xms1024M \
-Xmx1024M \
-Xss2M \
-XX:+UseLargePages \
-XX:+AlwaysPreTouch \
-XX:+PrintCommandLineFlags \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java_heapdump_%p.hprof \

Container support

1
2
3
4
5
6
7
8
9
-XX:+PrintContainerInfo \
-XX:+UseContainerSupport \
-XX:MinRAMPercentage=25 \
-XX:MaxRAMPercentage=75 \
-XX:+UseLargePages \
-XX:+AlwaysPreTouch \
-XX:+PrintCommandLineFlags \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java_heapdump_%p.hprof \

JMX

1
2
3
4
5
6
7
-Djava.rmi.server.hostname=<external IP> \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.port=18983 \
-Dcom.sun.management.jmxremote.rmi.port=18983 \

GC

GC log

1
2
3
4
5
6
7
8
9
-Xloggc:logs/gc.log \
-verbose:gc \
-XX:+DisableExplicitGC \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-XX:+PrintGCTimeStamps \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=2 \
-XX:GCLogFileSize=64M \

ParallelGC

1
2
-XX:+UseParallelGC \
-XX:+UseParallelOldGC \

ConcMarkSweepGC

1
2
3
4
-XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC \
-XX:+CMSParallelRemarkEnabled \
-XX:+CMSClassUnloadingEnabled \

G1GC

1
2
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=250 \

Misc

1
-Djava.awt.headless=true \