You may want to increase Tomcat memory for clustered JamfPro web apps. By default only 1Gb of memory is allocated to Tomcat. Increasing the memory can significantly improve performance. Normally you would use the database utility to change these settings, but in a clustered environment you have to change either the catalina.sh or setenv.sh scripts on Linux. (For macOS instructions click here.)
It is important to check memory allocation for the web app after each update as some releases will reset them back to default. I encountered that recently and it caused major problems for my end users downloading apps from Self Service.
The following steps will walk you through adjusting these settings in the catalina.sh script and/or the senenv.sh script. Note: I prefer changing setenv.sh referenced by catalina.sh. It’s a little cleaner and easier to find the variables.
If you used the Linux JSS Installer for a new installation, I have verified this work flow with JAMFPro versions 9.94 – 9.98.
Increase Tomcat Memory with catalina.sh
Locate and open the /usr/local/jss/tomcat/bin/catalina.sh file with either vim or nano. In a terminal window enter the following:
sudo vi /usr/local/jss/tomcat/bin/catalina.sh
Locate the JAVA_OPTS environment variable that defines memory and uncomment it if it is #commented. The variable looks something like the following:
JAVA_OPTS=” -XmxSizeM -XX:MaxPermSize=256M”
Allocate additional memory to Tomcat by modifying the -Xmx parameter.
For example, modifying the variable to look something like this gives you 1 GB of RAM:
JAVA_OPTS=” -Xmx1024M -XX:MaxPermSize=256M”
Save and close the file.
Increase Tomcat Memory with setenv.sh
Alternately you can change the settings in setenv.sh. You will find the script for setenv.sh in the same directory. Locate and open it with either vim or nano. In a terminal window enter the following:
sudo vi /usr/local/jss/tomcat/bin/setenv.sh
You will see environmental preferences for either JAVA_OPTS or CATALINA_OPTS.
Following similar steps listed above, I could use the following line to allocate 4G of memory in a JAVA_OPTS variable:
export JAVA_OPTS="$JAVA_OPTS -Xmx4096M -Xms -Djava.awt.headless=true"
Or you can modify the CATALINA_OPTS variable. I used this example to increase from 4G to 6G (pictured above):
export CATALINA_OPTS="$CATALINA_OPTS -Xmx6091 -XX:PermSize=256m -XX:MaxPermSize=256m"
That seemed a little cleaner given the line was already in setenv.sh and I only had to add -Xmx6091. Both JAVA_OPTS and CATALINA_OPTS seem to work. CATALINA_OPTS might be a better option if you run multiple Java applications. Using setenv.sh is kind of cool because it lets you make changes without mucking up the main script for Catalina. I included before and after pics below.
In the examples below, the memory is increased from 4 to 6 GB.
For more information see JAMF-Nation Article 139: Allocating Additional Memory in Tomcat and as always, Der Flounder’s documentation.