5

After installing Tomcat 5 what configuration changes/tweaks do you apply, and why?

Be specific: name what files you edit, what settings you change and why you do it.

Some areas of interest:

  • General configuration changes
  • Best practices with regards to "virtual host handling"
  • Performance tweaks
  • Stability tweaks
  • Security settings

5 Answers 5

2

Usually, I'm just tweaking startup parameters to adjust Heap sizes for better performance.

-server -Xms256m -Xmx1024m
2

Here is the simple script I use :

I have the default directoy "Catalina Home' and 'Catalina Base' I put the webapps into 'Catalina base' every time I launch my scripts, war are deployed. I also have some JAVA_OPTS : like run Java in deamon mode, I specify the memory I want to allocate I add the Timezone Also

#!/bin/sh

BIN_DIR=$HOME/bin
TOMCAT_DIR=$HOME/tomcat
CFG_DIR=$TOMCAT_DIR/conf

#export TZ="Europe/Paris"
#export LANG=fr_FR.UTF-8 export CATALINA_PID=$BIN_DIR/tomcat.pid
export CATALINA_BASE=$TOMCAT_DIR
export
CATALINA_HOME=/home/web/bin/apache-tomcat-6.0.16
export
LD_LIBRARY_PATH=$CATALINA_HOME/lib
export
JRE_HOME=/usr/lib/jvm/java-1.5.0-sun
export JAVA_OPTS="-server -Xmx800m
-Djava.awt.headless=true -XX:MaxPermSize=256m"

cd $CATALINA_HOME/bin

case $1 in

    start)
    $CATALINA_HOME/bin/catalina.sh start
-config $TOMCAT_DIR/conf/server.xml "$@"    ;;

    stop)   $CATALINA_HOME/bin/catalina.sh
stop -force -config
$TOMCAT_DIR/conf/server.xml "$@"    ;;

    deploy)     if [ ! -d $HOME/deploy ];
then        mkdir $HOME/deploy      fi  if [
-f $HOME/deploy/*.war ]; then       mv $HOME/deploy/*.war
$HOME/tomcat/webapps/   fi  ;;

    *)  echo "Usage : $0 (start|stop)"
    ;;

esac
0

In context configuration for webapps, which may be in ./conf/Catalina/localhost/.xml, ./webapps/.xml, or within ./conf/server.xml, I set reloadable="false". This prevents Tomcat from constantly polling for changes to the webapp's class files and jars, which is an unnecessary load. See the Context configuration documentation.

<Context path="/myapp" reloadable="true">

In ./conf/server.xml I go through and comment out bits I'm not using, such as unused connectors.

In ./conf/server.xml, look at the values for maxThreads, connectionTimeout, and similar attributes of the Connectors. There is no standard recommended value for these, you need to work out the optimal values based on your application, usage patterns, etc. See the documentation for the HTTP Connector and the AJP Connector for details.

I also strip out the default webapps, except for the ones I need.

Since I do use the tomcat-manager webapp, I lock it down. I configure the user account to access it, and configure Apache httpd access controls on the URL to lock access to relevant IP addresses.

Order deny,allow Deny from all Allow from 127.0.0.1 Allow from 192.168.0

Also in Apache, I block access to the WEB-INF directory (I don't have an example to hand).

0

Heap size for tweaking is better

0

Another good source of information would be this webinar

http://www.springsource.com/webinar/apache-tomcat-tips-and-tricks-pros

Unfortunately you have to register....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .