How To Adjust the Tomcat Memory Settings on Linux

  • 7020292
  • 23-Jun-2010
  • 10-Aug-2018




Searches in Retain take a very long time or never return.  The server has plenty of memory that it is not using.  What is the procedure for adjusting the amount of memory that Retain uses.


Adjusting the memory that tomcat uses on Linux is very easy.  Follow these steps to adjust the amount of memory that tomcat will use.

1.  Remote onto the Retain Server.  Either do this with PuTTY or logging directly into the server.

2.  Browse to /etc/opt/beginfinite/retain/tomcatx

Where "x" is the Tomcat version.   In Retain 2.x, this would be tomcat5, in 3.x and 4.0-4.1 tomcat7, 4.2 and above tomcat8

3.  Edit the file named j2ee

4.  Go to the section of the file that affects the memory settings (note: the actual current memory settings may likely vary on your system from what is shown in the following examples):

Retain 2.x and 3.x:  Find the line MEMORY_HEAP="-Xms2048M -Xmx2048m"

Retain 4.x:  Find the line CATALINA_OPTS="-Xms4g -Xmx6g -Xss256k"

5.  Change the both the -Xms (minimum memory) and the -Xmx (maximum memory) values to the desired value. 

It is recommended that they be set to the same value (see "Tomcat JVM - What  You Need to Know").

What you set this is largely determined by many variables, including how much RAM is on server, whether MySQL is running on the same server, whether there are Workers on the local server (and how many), etc.   See "Retain Planning and Design Best Practices" for a more in-depth discussion.

6.  Save the changes and restart tomcat.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 1763.