Configuring Tomcat memory utilization

It's also a good idea to configure the Tomcat memory utilization. 

Edit the file $TOMCAT_HOME/bin/setenv.sh and edit the parameter JAVA_OPTS, where you can increase the system memory managed by the JVM (Java Virtual Machine). 

OpenJDK 1.8

These are the default configuration file values. Tomcat will reserve 4096MB (Xmx parameter), and the size of the heap from version 1.8 is dynamically assigned by the JVM. For this configuration, your server needs at least 5.5 GB of RAM (it is good practice to always leave 1 GB of free RAM for the OS).

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx4096m -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Dlog4j.configuration=file://$CATALINA_HOME/conf/log4j.properties"
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dmail.mime.ignoreunknownencoding=true"
CATALINA_PID=$CATALINA_HOME/catalina.pid
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib/sigar

OpenJDK 1.7

These are the default configuration file values. Tomcat will reserve 4096MB (Xmx parameter) and a maximum heap of 512MB (-XX:MaxPermSize parameter). For this configuration, your server needs at least 5.5 GB of RAM (it is good practice to always leave 1 GB of free RAM for the OS).

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx4096m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Dlog4j.configuration=file://$CATALINA_HOME/conf/log4j.properties"
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dmail.mime.ignoreunknownencoding=true"
CATALINA_PID=$CATALINA_HOME/catalina.pid
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib/sigar

 

Table of contents [ Hide Show ]