This article explains how you can find your current JAVA memory configuration and what are the recommended settings.

Find your current settings

The quickest way to check your current configuration is using the option “System Information” in the xDM Application Builder:

A pop-up will display the configuration from your application server, search for the section Runtime Information:

Note: By default, Tomcat starts up with memory allocation of just 512 megabytes, in many situations, this is not enough. Other JVM configuration options may be important as well.

Recommended settings

Warning: Setting optimal memory options for a Java Virtual Machine is complex. It will be different depending on your exact usage patterns, there is no single answer which can be ideal for all environments.

1. Determine how to set CATALINA_OPTS or JAVA_OPTS in your environment.

  • In VMs and AMIs provided by Semarchy on Azure and AWS Marketplace, this is done in the file /etc/default/tomcat8
  • In “Semarchy xDM - Preconfigured with Apache Tomcat” JAVA_OPTS are set in the file or setenv.bat. The default value in xDM 5.2:
    CATALINA_OPTS="$CATALINA_OPTS -Xmx512m -server -XX:+UseG1GC -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger -Duser.language=en -Djava.awt.headless=true"
  • In many Linux environments these options set in the file /etc/tomcat8/tomcat8.conf

2. Experiment with different values to see what works best in your environment.

  1. In many circumstances, the maximum Java heap is the most important setting. Try 4GB as a reasonable first guess for many environments:
    Adjust this value up or down depending on your results. It is vital that your operating system actually has this much memory available. If you allocate 4GB to Java but the system only has 3GB available to be allocated, then Tomcat will crash. Oracle recommends a maximum of 1/4 of physical memory.
  2. Semarchy recommends the Garbage-First (G1) collector for xDM. It meets garbage collection (GC) pause time goals with a high probability while achieving high throughput.
  3. Semarchy recommends running the JVM in server mode. In very rough terms, the application server starts slower but should run faster.
    It is recommended to explicitly set it with the argument -server