Skip to end of metadata
Go to start of metadata

Configure Tomcat for production deployment

Tomcat is a great J2EE server and runs thousands of sites on the net. Unfortunately, there are no hard rules to adjust for "the best" production deployment settings, but here are the settings that worked the best in our experience with Razuna and Tomcat.

Use a front end web server

Thought, Tomcat can be used to serve Razuna directly, we encourage the use of a front end web server like IIS (best), Apache (better) or Nginx (the best). We have written dedicated pages how to do this with Apache and Nginx.

Memory & Garbage Collection Settings

We already have a dedicated site for Tomcat memory setting, but for production environment you should set the Maximum Heap Space to around 60% of your total RAM. The rule is to use as less as possible.

So, say you have 4GB of total RAM your memory settings would be (with a 60% rule and a bit less):

Tomcat APR

For optimal performance configuring and installing APR for Tomcat is a absolute must. We encourage you to read the installation note on the dedicated APR Tomcat site.

Tomcat Connector settings

After many months of trial and error we have found the following connector setting do work the best with Razuna:

Apache Tomcat by default sets a limit on the maximum size of HTTP POST requests it accepts. In Tomcat, this limit is set to 2 MB. When you try to upload files larger than 2 MB to Razuna, a error can occur.

The solution is to reconfigure Tomcat to accept larger POST requests, either by increasing the limit, or by disabling it. This can be done by editing /razuna/tomcat/conf/server.xml. Set the Tomcat configuration parameter maxPostSize for the HTTPConnector to a larger value (in bytes) to increase the limit. Setting it to 0 in will disable the size check. See the Tomcat Configuration Reference for more information.(http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)

  • No labels

4 Comments

  1. Anonymous

    Hi,

    where do we set this? CATALINA_OPTS="-server -Xss1G -Xms2G -Xmx2G $CATALINA_OPTS -XX:+UseConcMarkSweepGC -XX:NewSize=1G -XX:+UseParNewGC"

    In catalina.sh?

    1. The dedicated page for memory handling explains us that you have to create a file called "setenv.sh" and within that file you use those paramaters.

      Adjusting Memory Settings for Tomcat

      1. It's CATALINA_OPTS or JAVA_OPTS ?

        I set mine with JAVA_OPTS, reload Razuna, and the new mem amount shows correctly in Information Page.

        1. Java_opts = Is using the general Java memory pool

          Catalina_opts = Is using a dedicated Tomcat memory pool

          You need to restart Tomcat (not only Razuna) in order to make it work.