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

This is the default configuration file values. Tomcat will you 2048MB ( Xmx parameter ) and a heap is dinamically reserved by the JVM. For this configuration your server needs at least >=3.5GB of RAM ( Is a good practice always getting 1GB of free RAM for OS).

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx2048m -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

This is the default configuration file values. Tomcat will you 2048MB ( Xmx parameter ) and a maximum heap of 512MB ( -XX:MaxPermSize parameter ). For this configuration your server needs at least >=3.5GB of RAM ( Is a good practice always getting 1GB of free RAM for OS).

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx2048m -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