tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Woodings" <mwoodi...@austin.rr.com>
Subject Re: Tomcat configuration tuning
Date Thu, 08 Apr 2004 16:48:08 GMT
Hi Allistair,

Thanks for the quick response.  My server.xml file is below but to some of
the questions you had.  One of the biggest speed increases we gained was
from SQL optimization and table tuning.  One thing about server.xml
configuration which I realised is the acceptCount being set too high,
because if your server is struggling anyway having the requests backing up
is not going to help in fact may help it to go down.

What I mean by SQL optimization is we had java take over a lot of processing
rather than the database, so some of our queries may seem at first a little
broad but the speed increase was incredible.  Think how fast java can
iterate through a set of results rather than constantly referring to the db,
so that was one.   Also, one of our tables is heavily used and also ever
increasing in size, so to keep this fast I keep only a few weeks worth of
data in it (so its indexing is still really quick) and offload the rest to a
history table which is only used for reporting ... so based on date range I
either quickly recieve the latest info or slightly slower receive data from
the past.

Unfortunately I am unable to give you response times as they would be
meaningless (number of db hits, processing etc), but suffice to say its in
the region of 100msecs for non db jsp pages to 20+ secs (depending upon
connection) for insanely large amounts of db/processed pages and for the
vast majority of pages for select style queries are about 700msecs.  Sorry I
can't be of more help there.

I haven't read your post on caching yet, but I rely heavily on XML for our
site, from configuration to the menu options, and I also use streamed XML to
XSLT for all our views.  I guess it comes down to what you need to do, but I
would love to hear how you are using it.

One of the problems I am tackling at the moment is for places where there is
a lot of db inserts/updates which can't be done on-mass, so I am coming up
with a plan to assign these tasks to be fulfilled at off peak times, or in
manageable chunks so as to keep response times high.  One of the problems I
am overcoming is that our users aren't tech savvy and if a page doesn't load
fast enough they will hit reload constantly and escalate any memory problems
I may have had to the dreaded outOfMemory Exception.

Regards,

Matt

P.S. Struts ROCKS!!!

server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server className="org.apache.catalina.core.StandardServer" port="8005"
debug="0" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0" jsr77Names="false"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" override="true" type="java.lang.Integer"
value="30"/>
    <Resource name="UserDatabase" scope="Shareable"
type="org.apache.catalina.UserDatabase" auth="Container" description="User
database that can be updated and saved"/>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
  <Service className="org.apache.catalina.core.StandardService" debug="0"
name="Tomcat-Load-Balance-1">
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
redirectPort="8443" bufferSize="8192" port="8009" connectionTimeout="0"
enableLookups="true"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" debug="0"
disableUploadTimeout="true" maxProcessors="378" minProcessors="5"
acceptCount="100" useURIValidationHack="false" />
    <Engine jvmRoute="hsInstance" debug="0" defaultHost="instance1"
name="LoadBalance">
      <Host appBase="webapps" autoDeploy="true" debug="0" unpackWARs="true"
name="instance1">
        <Context crossContext="true" reloadable="true" debug="0"
docBase="**********" path="/hs" >
          <Resource name="jdbc/**********" scope="Shareable"
type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/**********">
            <parameter>
              <name>url</name>
              <value>**********</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>1000</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>10000</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>60000</value>
            </parameter>
            <parameter>
              <name>removeAbandoned</name>
              <value>true</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>**********</value>
            </parameter>
            <parameter>
              <name>logAbandoned</name>
              <value>true</value>
            </parameter>
            <parameter>
              <name>removeAbandonedTimeout</name>
              <value>30</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>**********</value>
            </parameter>
          </ResourceParams>
        </Context>
        <Logger className="org.apache.catalina.logger.FileLogger" debug="0"
verbosity="1" prefix="instance_1_log." directory="logs" timestamp="true"
suffix=".txt"/>
      </Host>
      <Logger className="org.apache.catalina.logger.FileLogger" debug="0"
verbosity="1" prefix="catalina_instance_1_log." directory="logs"
timestamp="true" suffix=".txt"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase" validate="true"/>
    </Engine>
  </Service>
</Server>

workers2.properties
[logger]
##############################################################
####    LOGGER                                            ####
##############################################################
# Log level. Supported: EMERG, ERROR, INFO, DEBUG
level=ERROR
# Log file. XXX you may be able to change this at runtime, to
# implement rolling.
file=${serverRoot}/logs/jk2_error.log

[config]
##############################################################
####    CONFIG                                            ####
##############################################################
# Location of the workers2.properties file
file=${serverRoot}/conf/workers2.properties
# Set the debug level of the config component
debug=0
# Set the debug level of the hidden env component
debugEnv=0

[shm]
##############################################################
####    SHARED MEMORY SETUP                               ####
##############################################################
# Name of the file that will be mmapped to use as shared memory,
# If set to 'anonymous' use the anonymous shered memory
file=${serverRoot}/logs/shm.file
# Number of shared memory slots. Set to the number of child
# processes
slots=378
# Use process memory instead of shared memory. Useful for single
# child mpm's
useMemory=0

[lb:lb_group]
##############################################################
####    LOAD BALANCER (EVEN IF USED ON ONE MACHINE)       ####
##############################################################
# If set, jk2 won't touch the headers in case of error and will
# let for example Apache present the
# ErrorDocument via mod_alias.
noErrorHeader=1
#
noWorkerMsg=No workers available
#
noWorkerCode=503
#
hwBalanceErr=
# If all the workers are in the error state, probably by Tomcat
# refusing any new connections due to the overload, you can set
# the timeout forcing lb to wait that some worker becomes
# available, instead of immediately returning error to the
# client. This is very useful in situations with high peek
# load. The timeout should be set to the maximum application
# call time, but not less then 1 second.
timeout=5000
# Number of attempts that lb will try on each worker before
# giving up.
attempts=6
# Time to wait before retrying to see if the worker came out of
# the error state. Default = 60secs
recovery=30
# Sessions stick to the same worker, 1=true 0=false
stickySession=1

[channel.socket:localhost:8009]
##############################################################
####    CHANNEL SETUP, LINKED TO LOAD BALANCER            ####
##############################################################
# Port where Tomcat is listening. It is automatically extracted
# from the name - you shouldn't have to specify it explicitely.
port=8009
# Remote host. You should use the name, no need to override it
host=127.0.0.1
# If 1, only requests for existing sessions will be forwarded
graceful=0
# ?
keepAlive=0
# Socket timeout for sending and receiving (0=infinite)
timeout=0
# Load balancing factor to use. At this moment, it'll be set on
# the worker, but in future it should be possible to use lb on
# a channel level.
lb_factor=100
# loadbalanced groups to which this channel and the associated
# worker will be added, multivalued. You need to set it only if
# you have an advanced setup with multiple clusters.
group=lb_group
# Must match the JVM route on tomcat Engine, for load balancing
tomcatId=hsInstance

[ajp13:localhost:8009]
##############################################################
####    AJP1.3 WORKER CONFIG                              ####
##############################################################
tomcatId=hsInstance
group=lb_group
channel=channel.socket:localhost:8009

[uri:/hs/*]
##############################################################
####    URI MAPPING, WHAT TO SEND TO TOMCAT               ####
##############################################################
group=lb_group

[status:jk_status]
##############################################################
####    JK STATUS GROUP                                   ####
##############################################################
info=Status worker, displays runtime information

[uri:/jkstatus/*]
##############################################################
####    JK STATUS CONFIG                                  ####
##############################################################
info=The Tomcat /jkstatus handler
group=status:jk_status


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message