Forums/Troubleshooting

Configure memory settings for Tomcat installed in Linux

Sean Tong
posted this on December 04, 2009 11:51 am

There are a couple of options to configure memory settings for Tomcat installed in a Linux environment.

Important: when deciding how much memory to allocate consider the more the better. The example below "1024" is the base recommendation. For a larger deployment it is highly recommended to do more.


Option 1. Add a script file  to /etc/profile.d to set CATALITA_OPTION environment varialbe.

a. Log in as root

b. Go to /etc/profile.d

c. Create a file called "tomcat.sh" with the following script:

export CATALINA_OPTS="-Xmx1024M  -XX:MaxPermSize=256M -Djava.awt.headless=true"

d. Restart Tomcat


Option 2: Add the script to the .bashrc  of the user running Tomcat For example, if  Tomcat is running as user "tomcat"

a. Go to ~tomcat

b. Edit file .bashrc and add the following line:

export CATALINA_OPTS="-Xmx1024M  -XX:MaxPermSize=256M -Djava.awt.headless=true"

c. Restart Tomcat