I'm using modjk2&Apache2 to load balance requests between my two tomcat4.0.5 application servers. Each session is assigned a sessionID, and generally, this ID is held throughout a users session. About 10% of all sessions are failing to be sticky - meaning a user is assigned multiple sessionIDs per visit. I'm at a loss as to why this is happening. 'stickySession=1' is specified in my workers2.properties.
Below are extracts of my
apache httpd.conf
apache workers2.properties
tomcat server.xml
The one peculiar section of this conf is the URL re-writing. Any requests hitting apache for are re-written by apache to:
This means that the request is automatically passed to a tomcat application server.
Can anyone see anything that might cause the stickySessions to become unstuck?
Your assistance is appreciated!
Apache2
-------
httpd.conf===================================================
LoadModule jk2_module modules/mod_jk2.so
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteRule ^/$ /application/startApplication.do [PT]
RewriteRule ^/index.htm$ /application/startApplication.do [PT]
RewriteRule ^/index.html$ /application/startApplication.do [PT]
RewriteLog "/usr/local/apache2/logs/rewrite.log"
RewriteLogLevel 0
<Directory /apps/public/application>
Options FollowSymLinks
AllowOverride None
Allow from all
</Directory>
<Location "/application/*">
JKUriSet worker lb:application
Allow from all
</Location>
workers2.properties===========================================
[config]
file=${serverRoot}/conf/workers2.properties
debug=10
debugEnv=10
[shm]
file=${serverRoot}/logs/shm.file
size=1048576
[logger.file:0]
file=/usr/local/apache2/logs/modjk2.log
level=ERROR
[logger]
level=ERROR
[workerENV:]
info=Global server options
logger=logger.file:0
timing=1
debug=0
[channel.socket:tomcat04:8009]
info=Ajp13 connection to tomcat04
tomcatId=server01
port=8009
host=tomcat04
keepalive=1
debug=0
graceful=0
group=lb:application
[channel.socket:tomcat05:8009]
info=Ajp13 connection to tomcat05
tomcatId=server02
port=8009
host=tomcat05
keepalive=1
debug=0
graceful=0
group=lb:application
[ajp13:tomcat04:8009]
info=Ajp13 worker for tomcat04
channel=channel.socket:tomcat04:8009
max_connections=128
debug=0
[ajp13:tomcat05:8009]
info=Ajp13 worker for tomcat05
channel=channel.socket:tomcat05:8009
max_connections=128
debug=0
[lb:application]
worker=ajp13:tomcat04:8009
worker=ajp13:tomcat05:8009
stickySession=1
debug=0
[status:status]
info=Displays status information and checks config files for changes
Tomcat4.0.5
-----------
server.xml====================================================
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080"
minProcessors="5"
maxProcessors="75"
enableLookups="false"
redirectPort="8443"
acceptCount="10"
debug="0"
connectionTimeout="60000"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009"
minProcessors="50"
maxProcessors="512"
enableLookups="false"
acceptCount="10"
debug="0"/>
<!-- Define the top level container in our container hierarchy -->
<Engine jvmRoute="server01" name="Standalone" defaultHost=" debug="0">
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="catalina."
suffix=".log"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<!-- Define the default virtual host -->
<Host name=" debug="0" appBase="webapps" unpackWARs="true">
<!-- autoconfig for apache in auto -->
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />
<!-- Default access log -->
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="access."
suffix=".log"
resolveHosts="false"
pattern="common"/>
<!-- Logs all JVM messages for applets -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="tomcat."
suffix=".log"
timestamp="true"/>
<!-- Tomcat Manager Context -->
<Context path="/manager"
docBase="manager"
debug="0"
privileged="true">
<!-- Log other messages from the Manager applet -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="manager."
suffix=".log"
timestamp="true"/>
<!-- Access control for this applet -->
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="<ip ranges>"/>
</Context>
<!-- End of Manager Context -->
<!-- application Context -->
<Context path="/application"
docBase="application.war"
debug="0"
crossContext="true"
reloadable="true">
</Context>
</Host>
</Engine>
</Service>
</Server>
Below are extracts of my
apache httpd.conf
apache workers2.properties
tomcat server.xml
The one peculiar section of this conf is the URL re-writing. Any requests hitting apache for are re-written by apache to:
This means that the request is automatically passed to a tomcat application server.
Can anyone see anything that might cause the stickySessions to become unstuck?
Your assistance is appreciated!
Apache2
-------
httpd.conf===================================================
LoadModule jk2_module modules/mod_jk2.so
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteRule ^/$ /application/startApplication.do [PT]
RewriteRule ^/index.htm$ /application/startApplication.do [PT]
RewriteRule ^/index.html$ /application/startApplication.do [PT]
RewriteLog "/usr/local/apache2/logs/rewrite.log"
RewriteLogLevel 0
<Directory /apps/public/application>
Options FollowSymLinks
AllowOverride None
Allow from all
</Directory>
<Location "/application/*">
JKUriSet worker lb:application
Allow from all
</Location>
workers2.properties===========================================
[config]
file=${serverRoot}/conf/workers2.properties
debug=10
debugEnv=10
[shm]
file=${serverRoot}/logs/shm.file
size=1048576
[logger.file:0]
file=/usr/local/apache2/logs/modjk2.log
level=ERROR
[logger]
level=ERROR
[workerENV:]
info=Global server options
logger=logger.file:0
timing=1
debug=0
[channel.socket:tomcat04:8009]
info=Ajp13 connection to tomcat04
tomcatId=server01
port=8009
host=tomcat04
keepalive=1
debug=0
graceful=0
group=lb:application
[channel.socket:tomcat05:8009]
info=Ajp13 connection to tomcat05
tomcatId=server02
port=8009
host=tomcat05
keepalive=1
debug=0
graceful=0
group=lb:application
[ajp13:tomcat04:8009]
info=Ajp13 worker for tomcat04
channel=channel.socket:tomcat04:8009
max_connections=128
debug=0
[ajp13:tomcat05:8009]
info=Ajp13 worker for tomcat05
channel=channel.socket:tomcat05:8009
max_connections=128
debug=0
[lb:application]
worker=ajp13:tomcat04:8009
worker=ajp13:tomcat05:8009
stickySession=1
debug=0
[status:status]
info=Displays status information and checks config files for changes
Tomcat4.0.5
-----------
server.xml====================================================
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080"
minProcessors="5"
maxProcessors="75"
enableLookups="false"
redirectPort="8443"
acceptCount="10"
debug="0"
connectionTimeout="60000"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009"
minProcessors="50"
maxProcessors="512"
enableLookups="false"
acceptCount="10"
debug="0"/>
<!-- Define the top level container in our container hierarchy -->
<Engine jvmRoute="server01" name="Standalone" defaultHost=" debug="0">
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="catalina."
suffix=".log"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<!-- Define the default virtual host -->
<Host name=" debug="0" appBase="webapps" unpackWARs="true">
<!-- autoconfig for apache in auto -->
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />
<!-- Default access log -->
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="access."
suffix=".log"
resolveHosts="false"
pattern="common"/>
<!-- Logs all JVM messages for applets -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="tomcat."
suffix=".log"
timestamp="true"/>
<!-- Tomcat Manager Context -->
<Context path="/manager"
docBase="manager"
debug="0"
privileged="true">
<!-- Log other messages from the Manager applet -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="manager."
suffix=".log"
timestamp="true"/>
<!-- Access control for this applet -->
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="<ip ranges>"/>
</Context>
<!-- End of Manager Context -->
<!-- application Context -->
<Context path="/application"
docBase="application.war"
debug="0"
crossContext="true"
reloadable="true">
</Context>
</Host>
</Engine>
</Service>
</Server>