NetX runs within Apache Tomcat, and Tomcat runs within Java (the Java Virtual Machine, or "JVM"). In order to tune memory setting for NetX, you do so via Tomcat — specifically with the CATALINA_OPTS environment variable. On Unix systems (Mac, Linux, et al), this is typically specified in Tomcat's setenv.sh file. This lives within the main Tomcat installation root, and within the "bin" sub-folder, eg:
/netx/bin/setenv.sh
The contents of this file look like this for a default installation:
#!/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;
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 every 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 which Java will immediate expand to. Often, this can simply be set to the same value as Xmx. Default: 2g |
Xmx |
This is the maximum memory which Java can ultimate 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
Changing these values on Windows requires you to use Tomcat's UI tool — and it must be done so manually — which is located here:
C:\Program Files\Netx\bin\netxw.exe
There, and 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 an input text area for "Java Options"; there you can input the following:
-XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 -XX:+HeapDumpOnOutOfMemoryError
Learning more
Tuning the JVM and Garbage Collector is considered by many to be of the "dark arts", so to speak. For more information please refer to these articles:
https://docs.oracle.com/cd/E40972_01/doc.70/e40973/cnf_jvmgc.htm