This article will help on-premise administrators tune application memory settings within Tomcat.
JVM settings
The following table describes the default JVM settings that ship with NetX:
Setting | Description |
---|---|
XX:+UseG1GC |
This is only available if you are running Java 1.8+; otherwise, please remove this variable. |
XX:+HeapDumpOnOutOfMemoryError |
This directs the JVM to dump its heap into a dump file if Tomcat ever runs out of memory; this can be useful in determining why such an event occurred. |
Dexo |
This is merely a process ID tag, used by NetX internally. Please do not adjust or remove this. Default: netx |
Xms |
This is the initial memory that Java will immediately expand to. Often, this can be set to the same value as Xmx. Default: 2g |
Xmx |
This is the maximum memory that Java can ultimately use. Default: 4g |
The only values you should ever really need to change are the heap memory sizes — Xms and Xmx. For many larger deployments, these values are as follows (roughly speaking)
Assets | Xms | Xmx |
---|---|---|
10,000,000 | 16g | 32g |
10,000 |
2g |
4g |
100,000 |
4g |
8 |
1,000,000 |
8g |
16g |
Windows
To change JVM options, stop your Netx instance, then launch Tomcat's UI tool, located here:
C:\Program Files\Netx\bin\netxw.exe
On the Java tab, you will find inputs for Initial memory pool (which sets the Xms) and Maximum memory pool (which sets the Xmx). Additionally, there is a text area for Java Options where you can input the settings below. When you are finished making changes, start your NetX instance again.
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:ParallelGCThreads=20
-XX:ConcGCThreads=5
-XX:InitiatingHeapOccupancyPercent=70
-XX:+HeapDumpOnOutOfMemoryError
Linux
On Linux systems, JVM settings are typically specified in Tomcat's setenv.sh file, located here:
/netx/bin/setenv.sh
The contents of this file look like this for a default installation. To make changes, stop your NetX instance and edit the parameters in the CATALINA_OPTS environment variable. When you are finished making changes, start your NetX instance again.
#!/bin/sh
# ---------------------------------------------------------------------------------------
# Set JAVA_OPTS here
# ---------------------------------------------------------------------------------------
NETX_ID="netx"
export NETX_ID;
CATALINA_OPTS="$CATALINA_OPTS -Dexo=$NETX_ID -Xms2g -Xmx4g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 -XX:+HeapDumpOnOutOfMemoryError -Dlog.directory=$CATALINA_BASE/logs"
export CATALINA_OPTS;