Hi guys,
I am at stage where I have all my various components talking to one another (Apache
http server 2.0.49 -> Mod JK2 -> Tomcat 4.1.30) and running nicely with each other,
but the loads on the server are increasing rapidly in our production environment (
~2000 logins/day and peak concurrency of ~75 currently ) and I want to get the best
possible configuration for my server. (Dual 1GHz, 1GB Ram, Win 2k, SQL Server +
Web/Apps servers).
Now, ultimately this is up to me, but I am unsure of a few relationships and variables
used in the configuration files. The settings I have work, but I want them to be
optimal and more importantly I want to understand them, so any help on the following
would be greatly appreciated.
1) server.xml/Connector/bufferSize. Is this allocated for every users session until
it is terminated, or is it a peak size that could be allocated?
2) workers2.properties/shm.slots. Does this equate to the
server.xml/Connector/maxProcessors? or are these fundamentally different?
I have attached my fully working configuration below for those who are interested, as
I noticed a lot of people in the archives looking for working examples using JK2.
Many thanks,
Matt
P.S. I am new to the list but I have been using Tomcat for many years and love it, and
if I can help with anyones queries, from the trivial to complex, I would be only too
happy to do so.
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