You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeff Fulmer <je...@joedog.org> on 2009/03/19 14:02:17 UTC
mod_jk through a firewall (yes, I RTFM)
I'm having difficulty with failover testing. When a tomcat server goes
away due to networking issues, the site become effectively unusable.
Here's the architecture:
=> apache1 tomcat1
LB FW
=> apache2 tomcat2
If I stop the tomcat server tomcat2, there's no problem. It properly
closes the sockets and mod_jk/apache/linux knows the server went away. But
if I shutdown the network on tomcat2 (or yank the cable), mod_jk continues
to send packets to it. My socket table is filled with connections to
tomcat2:8009 in SYN_SENT. Apache continues to send every other request to
tomcat2. Since I use session stickiness, this only effects half the users
but still.
Here's my workers.properties file:
ps=/
# Define list of workers that will be used
# for mapping requests
# When load-balancing is used, real workers should not be listed here.
worker.list=balancer,status
# Definte default worker settings
worker.default.port=8009
worker.default.type=ajp13
worker.default.lbfactor=1
worker.default.socket_timeout=120
worker.default.reply_timeout=5000
worker.default.socket_keepalive=True
worker.default.ping_mode=P
worker.default.ping_timeout=5000
worker.default.connect_timeout=5000
worker.default.prepost_timeout=5000
worker.default.connection_pool_timeout=180
#------WORKER1-------
worker.worker1.reference=worker.default
worker.worker1.host=10.248.11.15
#------WORKER2-------
worker.worker2.reference=worker.default
worker.worker2.host=10.248.11.16
#------BALANCER------
worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
worker.balancer.sticky_session=true
worker.balancer.method=R
worker.balancer.lock=P
worker.balancer.sticky_session=1
# Status worker for managing load balancer
worker.status.type=status
And here's my apache configuration:
<IfModule mod_jk.c>
JkWorkersFile /etc/httpd/conf/workers.properties
JkShmFile /var/log/httpd/mod_jk.shm
JkLogFile /var/log/httpd/mod_jk.log
JkOptions +DisableReuse
JkMount /rp/* balancer
JkMount /rp balancer
</IfModule>
Any thoughts?
TIA,
Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk through a firewall (yes, I RTFM)
Posted by Jeff Fulmer <je...@joedog.org>.
> On 19.03.2009 14:02, Jeff Fulmer wrote:
>>
>> If I stop the tomcat server tomcat2, there's no problem. It properly
>> closes the sockets and mod_jk/apache/linux knows the server went away.
>> But if I shutdown the network on tomcat2 (or yank the cable), mod_jk
>> continues to send packets to it. My socket table is filled with
>> connections to tomcat2:8009 in SYN_SENT. Apache continues to send every
>> other request to tomcat2. Since I use session stickiness, this only
>> effects half the users but still.
>
> This should be handled by the socket_timeout, which you set to 2 minutes.
> How does it behave, if you reduce your socket timeout say to 10 seconds?
MAJOR IMPROVEMENT. Here's my revised workers.properties file:
worker.list=balancer,status
# Definte default worker settings
worker.default.port=8009
worker.default.type=ajp13
worker.default.lbfactor=1
worker.default.socket_timeout=10
worker.default.reply_timeout=5000
worker.default.socket_keepalive=True
worker.default.ping_mode=P
worker.default.ping_timeout=5000
worker.default.connection_pool_timeout=600
worker.default.connection_pool_minsize=0
#------WORKER1-------
worker.worker1.reference=worker.default
worker.worker1.host=10.248.11.15
#------WORKER2-------
worker.worker2.reference=worker.default
worker.worker2.host=10.248.11.16
#------BALANCER------
worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
# Load balancing method can be [R]equest, [S]ession, [T]raffic, or [B]usyness
worker.balancer.method=R
# How runtime data are sync-ed. [O]ptimistic or [P]essimistic
worker.balancer.lock=O
worker.balancer.sticky_session=True
worker.balancer.max_reply_timeouts=5
# Status worker for managing load balancer
worker.status.type=status
And in my virtual host I have this:
<IfModule mod_jk.c>
JkOptions +JkWatchdogInterval
JkMount /rp/* balancer
JkMount /rp balancer
JkMount /env/* balancer
JkMount /env balancer
JkMount /jkmanager/* status
</IfModule>
BTW: /jkmanager/* is at the server level, but I included it here for
Rainer...
Here's my remaining problem. After I shut down the network on tomcat2, I
have a few 30 second request transactions but each ensuing transaction is
pretty zippy. If I leave my browser sit idly for about a minute, I have
two 30 second transactions and each ensuing transaction is zippy. I
suspect I have two back-to-back 30 second transactions because the load
balancer sends me to apache1 then apache2 and each tries to reconnect to
the downed tomcat. After that fails, they keep me on the active tomcat.
Maybe this one be a problem once the system is taking live transactions
but it would be nice if I could increase the intervals that apache uses to
reconnect to the downed tomcat.
Any thoughts?
Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk through a firewall (yes, I RTFM)
Posted by Rainer Jung <ra...@kippdata.de>.
On 19.03.2009 14:02, Jeff Fulmer wrote:
> I'm having difficulty with failover testing. When a tomcat server goes
> away due to networking issues, the site become effectively unusable.
> Here's the architecture:
>
> => apache1 tomcat1
> LB FW
> => apache2 tomcat2
>
> If I stop the tomcat server tomcat2, there's no problem. It properly
> closes the sockets and mod_jk/apache/linux knows the server went away. But
> if I shutdown the network on tomcat2 (or yank the cable), mod_jk continues
> to send packets to it. My socket table is filled with connections to
> tomcat2:8009 in SYN_SENT. Apache continues to send every other request to
> tomcat2. Since I use session stickiness, this only effects half the users
> but still.
This should be handled by the socket_timeout, which you set to 2
minutes. How does it behave, if you reduce your socket timeout say to 10
seconds?
Peferrably you would use a recent JK. There you can tune the
socket_connect_timeout individually to something really small (soince
1.2.27).
Maybe you just want to test the latest 1.2.28 snapshot, We are very
close to the final 1.2.28 release (planned for tomorrow). The most
recent snapshot is available at
http://people.apache.org/~rjung/mod_jk-dev/source/jk-1.2.28-dev/tomcat-connectors-1.2.28-dev-756058-src.tar.gz
You can further tune error detection behaviour for 1.2.28 by setting
error_escalation_time to something small, you can even try "0".
> Here's my workers.properties file:
>
> ps=/
"ps" dos not have any meaning here. Simply delete it.
> # Define list of workers that will be used
> # for mapping requests
> # When load-balancing is used, real workers should not be listed here.
> worker.list=balancer,status
>
> # Definte default worker settings
Using a template, so yes, you RTFM :)
> worker.default.port=8009
> worker.default.type=ajp13
> worker.default.lbfactor=1
> worker.default.socket_timeout=120
> worker.default.reply_timeout=5000
5 seconds as a reply timeout is pretty ambitious. Without
max_reply_timeouts this means, that even a single request that takes
longer as 5 seconds to process will put the respective worker into an
error state.
> worker.default.socket_keepalive=True
> worker.default.ping_mode=P
> worker.default.ping_timeout=5000
> worker.default.connect_timeout=5000
> worker.default.prepost_timeout=5000
ping_mode "P" does only do the prepost ping, so no need to set
connect_timeout (which is for another type of ping). You should also
drop the prepost_timeout, because you already have the mor egeneral
ping_timeout, and with your multiple definitions you and others might
woner, which of those settings are actually active.
> worker.default.connection_pool_timeout=180
Remember to sync this with Tomcats connectionTimeout in the AJP
connector (but there its milliseconds and not seconds).
> #------WORKER1-------
> worker.worker1.reference=worker.default
> worker.worker1.host=10.248.11.15
>
> #------WORKER2-------
> worker.worker2.reference=worker.default
> worker.worker2.host=10.248.11.16
>
> #------BALANCER------
> worker.balancer.type=lb
> worker.balancer.balance_workers=worker1,worker2
> worker.balancer.sticky_session=true
> worker.balancer.method=R
> worker.balancer.lock=P
Locking should be fine with the default (optimistic). no more need for
pessimistic locking.
> worker.balancer.sticky_session=1
t, T, true, True and 1 all are the same. You set thius attribute twice,
once above "True" and then here "1".
> # Status worker for managing load balancer
> worker.status.type=status
>
> And here's my apache configuration:
>
> <IfModule mod_jk.c>
> JkWorkersFile /etc/httpd/conf/workers.properties
> JkShmFile /var/log/httpd/mod_jk.shm
> JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
> JkOptions +DisableReuse
You really want to use that? Better think about setting
connection_pool_minsize to "0" and activating the JkWatchdogInterval.
> JkMount /rp/* balancer
> JkMount /rp balancer
No mount for the status worker?
> </IfModule>
>
> Any thoughts?
>
> TIA,
> Jeff
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org