Tomcat Memory Configuration for Linux

 

NOTE: It is recommended to increase the Java heap size of Tomcat to avoid the initiation of garbage collection when memory usage hits the set threshold. The steps may vary depending on how Tomcat was deployed.

 

  1. Stop Tomcat.
  2. Create a file named setenv.sh.
  3. Place the file in the Tomcat bin folder.
  4. Set the minimum and maximum heap size with the JVM–Xms  and –Xmx parameters. A minimum of 1 GB is recommended. For example:

    JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -server -Xms512m -Xmx2g"

    NOTE: 

    • Setting the maximum value should be dependent on your system. Ensure that the heap size is not larger than the available free RAM on your system. It is recommended to use 80% of the available RAM not taken by the operating system or other processes of your JVM.
    • If you configure your server with a maximum heap size that is too small, you may experience very slow data loading times. The server will reach a point where nearly all of the heap is used, and Java will start doing garbage collection. This happens again and again, and garbage collection becomes a very large portion of all the processing done. This leaves very little system resources for the Panopticon server to process the data, and a task that should take 100 milliseconds could be going on for 30 seconds or more.
  5. Save the file.
  6. Restart Tomcat to apply the increase in the heap.

 

(c) 2013-2025 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support