Apache Tomcat Java Option Settings
Mandatory Settings
Setting
Description
-server
Tells the JVM to run in server mode. This is true by default when using 64-bit JDK, but it is best practice to declare it.
-d64
Tells the JVM to run in 64-bit mode. The current JVM automatically detects this, but it is best practice to declare it.
-XX:+UseG1GC
Tells the JVM to use the Garbage First Garbage Collector.
-Dfile.encoding=UTF-8
Tells the JVM to use UTF-8 as the default character set so that non-Western alphabets are displayed correctly.
-Djava.library.path
Specifies the path to the native library.
-Xms3072m (for a system with 4GB of memory)
Tells the JVM to allocate a minimum of 3072MB of memory to the Tomcat process. This should be set to 75% of the available system memory.
* 
The amount of memory needs to be tuned depending on the actual environment.
-Xmx3072m (for a system with 4GB of memory)
Tells the JVM to limit the maximum memory to the Tomcat process. This should be set to 75% of the available system memory.
Things to consider:
The amount of memory must be tuned depending on the actual environment. 5GB of memory is a good starting point for 100,000 Things.
The reason for making the minimum and maximum amounts of memory equal is to avoid the JVM having to re-evaluate required memory and resize the allocation at runtime. While this is recommended for hosted and/or public facing environments, for development and test environments, using –Xms512m would suffice. Also, verify that there is enough memory left to allow the operating system to function.
-Dlog4j2.formatMsgNoLookups=true
Optional Settings to Enable JMX Monitoring for VisualVM or JConsole
Setting
Description
-Dcom.sun.management.jmxremote
Notifies the JVM that you plan to remote monitor it via JMX
-Dcom.sun.management.jmxremote.port=22222
The port that the JVM should open up for monitoring.
-Dcom.sun.management.jmxremote.ssl=false
No SSL usage.
-Dcom.sun.management.jmxremote.authenticate=false
No authentication required.
-Djava.rmi.server.hostname=<host or IP>
The hostname or IP that the underlying RMI client connection will use.
Was this helpful?