JVM Tuning
There are some recommended JVM settings for optimizing in ThingWorx performance that should be made. Fine tuning the JVM parameters beyond the ones that are listed below is workload specific and depends on the applications that are built with ThingWorx. For specific tuning based on your environment, contact PTC Support.
Mandatory Settings
Setting
Description
-server
Explicitly 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
Explicitly 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.
* 
The reason that the min and max amounts of memory are made equal is to reduce JVM having to re-evaluate required memory and resizing the allocation at run time. 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
If you suspect that there are memory issues, reference the following tools for more information on monitoring your system:. The setting listed will enable connecting those tools to the Tomcat instance used by ThingWorx to monitor the JVM characteristics.
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 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?