Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

By default, tomcat comes Tomcat is installed with the memory setting of 256MB , whereas the recommended memory for OpenSpecimen is 2GB. This could lead to out of memory error when processing large amount of data. E.g. bulk upload, export, etc.

This document describes the steps to increase the memory for Java process in tomcat. 

If OpenSpeicmen installed using the installer, it will set above memory settings by default. Set below settings if tomcat is not installed using OpenSpecimen installer or not using recommended settings.

fix this. 

How to check what is max memory set for java processthe current memory setting?

  1. Open $TOMCAT_HOME/logs/catalina.out file.
  2. Search for the string "-Xmx" 
    It will look like -Xmx2048m If memory is less than 2048 then it means max memory is less than 2 GB.if set to 2GB.

How to set

...

memory

...

?

Windows:

  1. Delete the existing tomcat Tomcat service with command: SC DEL <name of the tomcat service>. The service name can be checked in the services.
  2. Open $TOMCAT_HOME/bin/service.bat in any text editor.
  3. Search for the string "--JvmMx"
  4. Change the max memory to 2 GB (recommended)
    > Before --JvmMx 256
    >After --JvmMx 2048
  5. Save the file.
  6. Open command prompt
  7. Go to $TOMCAT_HOME/bin
  8. Run the command service.bat install 
  9. Start the newly installed Apache Tomcat service.

Linux:

  1. Create a new file setenv.sh inside $TOMCAT_HOME/bin/ directory. Add the below line in newly created setenv.sh file :
    export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m"
  2. Restart the tomcat Tomcat service using command - su service <service_name> restart.