You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Br...@thomson.com on 2007/09/17 17:40:36 UTC

With JK 1.2.x using route causes problems with redirect?

All,
 
Good day!
 
For a little background, I'm working on implementing "sub-clusters" with
the new connector. That is, I will cluster my Tomcats in paris to keep
network traffic/memory usage down. The connector would preferrentially
fail-over between sub-cluster Tomcat pairs. But if both elements of a
Tomcat cluster go down, I'd like the connector to fail-over to another
sub-cluster (with session loss).
 
I realize that the connector "Domain" directive was meant for this. My
reading of the docs, however, would imply that since the jvmRoute is the
domain (with sticky sessions), the requests going into a domain would be
load-balanced between domain memembers. This would in turn imply (for
those of us who are paranoid), that we'd have to do synchronous session
replication at the Tomcat level to *ensure* that under heavy load
sessions would be replicated before  a user is balanced between cluster
members. This would then, potentially, slow responses to the client
since sending the response would be delayed until session replication is
complete. (Perhaps I should try everything to confirm all this since the
docs are a wee bit vagues...) So, I thought I'd be sneaky and try other
directives. Hence:
 
I am trying to use JK 1.2.25 to access Tomcat 6. I am setting up 4
servers paired in two different clusters at the Tomcat level. In the
workers.properties I have:
 
- 4 workers: w1,w2,w3,w4
- All 4 workers are sub-workers of a load balancer called "router"
- The 4 workers are configured as two "pairs" where the worker pairs
preferrentially fail-over to each other using the "redirect" directive.
- In order to prepare for some more exotic configuration, I have used
the "route" directive to de-couple the worker name from the
route/jvmRoute which I use for sticky load balancing.
- The exotic config will be to define multiple load balancers so I can
switch them out at runtime via the url=>worker mapping file (since one
can't reload the workers.properties file at runtime, which is a
bummer!).
 
I have found that the "redirect" directive is not working all the time.
If w1 and w2 are set to preferentially fail-over to each other, it does
not always happen. For example, if I kill the Tomcat w1 is pointing to,
the connector will at times fail-over to the Tomcat w4 is pointing to.
 
If I remove the "route" directive from all workers and ensure the worker
names match the jvmRoute in Tomcat, all is well - I don't get the
incorrect fail-overs. It seems then the "redirect" pairs always failover
to each other.
 
Note that the problem seems to appear after I do a failover that behaves
properly once, restart the failed servers, and try another failover
test.
 
Is my config incorrect? Do the "route" and "redirect" directives not
play well with each other?
 
I've tried this on Windoze (see config below) with all Tomcats on my
desktop. I've also tried in on Linux with the Tomcats on 4 different
servers. Same behaviour.
 
Thanks very much in advance!
 
My workers.properties is as follows:
 

### Global worker maintenance interval in seconds
worker.maintain=30
 
###
### The list of all workers
### 
worker.list=router
 
###
### The real workers
### 
# Set w1 properties 
worker.w1.socket_keepalive=1
worker.w1.socket_timeout=20
worker.w1.reply_timeout=20000
worker.w1.retries=2
worker.w1.connection_pool_timeout=60
worker.w1.type=ajp13
worker.w1.host=localhost
worker.w1.port=8031
worker.w1.lbfactor=1
worker.w1.redirect=w2
worker.w1.route=tc1
 
# Set w2 properties 
worker.w2.socket_keepalive=1
worker.w2.socket_timeout=20
worker.w2.reply_timeout=20000
worker.w2.retries=2
worker.w2.connection_pool_timeout=60
worker.w2.type=ajp13
worker.w2.host=localhost
worker.w2.port=8032
worker.w2.lbfactor=1
worker.w2.redirect=w1
worker.w2.route=tc2
 
# Set w3 properties 
worker.w3.socket_keepalive=1
worker.w3.socket_timeout=20
worker.w3.reply_timeout=20000
worker.w3.retries=2
worker.w3.connection_pool_timeout=60
worker.w3.type=ajp13
worker.w3.host=localhost
worker.w3.port=8033
worker.w3.lbfactor=1
worker.w3.redirect=w4
worker.w3.route=tc3
 
# Set w4 properties 
worker.w4.socket_keepalive=1
worker.w4.socket_timeout=20
worker.w4.reply_timeout=20000
worker.w4.retries=2
worker.w4.connection_pool_timeout=60
worker.w4.type=ajp13
worker.w4.host=localhost
worker.w4.port=8034
worker.w4.lbfactor=1
worker.w4.redirect=w3
worker.w4.route=tc4
 
# router is a load balancer 
worker.router.type=lb
worker.router.balance_workers=w1,w2,w3,w4
worker.router.sticky_session=True
worker.router.sticky_session_force=False
worker.router.method=S
worker.router.recover_time=30
 
###
### The status worker
### 
worker.list=jkstatus
worker.jkstatus.type=status

 
Brian D. Horblit
Senior Principal Engineer
Thomson Healthcare

(303) 486-6697
(800) 525-9083 x 6697
www.thomsonhealthcare.com <http://www.thomsonhealthcare.com/> 
brian.horblit@thomson.com
 

RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.

Rainer (and all interested),

Just thought I'd let you know I threw some load at 4 Tomcats behind 1
Apache with the JK connector using domains and routes to implement two
different clusters of two Tomcats each and it seems to work well. My
load test tool (Grinder) reported that I was executing about 23
transactions per second overall(however accurate that is). Not
exhaustive testing, but it looks good so far ;-)

Brian Horblit


-->-----Original Message-----
-->From: Horblit, Brian (TH USA) 
-->Sent: Tuesday, September 18, 2007 12:30 PM
-->To: users@tomcat.apache.org
-->Subject: RE: With JK 1.2.x using route causes problems with redirect?
-->
-->
-->When I get multicast working in my Linux environment I'll 
-->put it under load and do the same failover tests to see how 
-->it fares when it is working harder! Maybe I'll do the same 
-->for the route/redirect method too.
-->
-->-->-----Original Message-----
-->-->From: Rainer Jung [mailto:rainer.jung@kippdata.de]
-->-->Sent: Tuesday, September 18, 2007 11:59 AM
-->-->To: Tomcat Users List
-->-->Subject: Re: With JK 1.2.x using route causes problems 
-->with redirect?
-->-->
-->-->Brian.Horblit@thomson.com wrote:
-->-->> Henk and Rainer,
-->-->> 
-->-->> My sincerest apologies! I don't know how many times I 
-->checked that 
-->-->> config without noticing the error. Sorry to waste your
-->-->time. Probably
-->-->> too many edits/tests wore my eyes out. :-(
-->-->
-->-->No problem. I learned something too (redirect=route), and found 
-->-->another tester for the domain feature :)
-->-->
-->-->> I fixed that domain up and yes indeed, it seems to be
-->-->working. I did 6
-->-->> combinations of server fails and restarts with the
-->-->expected behavior
-->-->> each time.
-->-->> 
-->-->> Thanks once again,
-->-->> 
-->-->> Brian
-->-->
-->-->Have fun!
-->-->
-->-->Rainer
-->-->
-->-->----------------------------------------------------------
-->-----------
-->-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, 
-->-->e-mail: users-unsubscribe@tomcat.apache.org
-->-->For additional commands, e-mail: users-help@tomcat.apache.org
-->-->
-->-->
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.
When I get multicast working in my Linux environment I'll put it under
load and do the same failover tests to see how it fares when it is
working harder! Maybe I'll do the same for the route/redirect method
too.

-->-----Original Message-----
-->From: Rainer Jung [mailto:rainer.jung@kippdata.de] 
-->Sent: Tuesday, September 18, 2007 11:59 AM
-->To: Tomcat Users List
-->Subject: Re: With JK 1.2.x using route causes problems with redirect?
-->
-->Brian.Horblit@thomson.com wrote:
-->> Henk and Rainer,
-->> 
-->> My sincerest apologies! I don't know how many times I checked that 
-->> config without noticing the error. Sorry to waste your 
-->time. Probably 
-->> too many edits/tests wore my eyes out. :-(
-->
-->No problem. I learned something too (redirect=route), and 
-->found another tester for the domain feature :)
-->
-->> I fixed that domain up and yes indeed, it seems to be 
-->working. I did 6 
-->> combinations of server fails and restarts with the 
-->expected behavior 
-->> each time.
-->> 
-->> Thanks once again,
-->> 
-->> Brian
-->
-->Have fun!
-->
-->Rainer
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.
Rainer,

I thought I should just note that part of the "exotic" config (using
"route" and the like) is driven by the fact that the workers.properties
file is not dynamically reloadable. 

We have had a modified version of the JK2 connector running for years
and we heavily use the capability to dynamically reload  the
workers2.properties file to update worker activation status during the
deploy of new app versions. I was mulling over how to get similar
functionality (without apachectl/graceful) via multiple load balancers
pointing to workers in different states and switching things out
dynamically at the url=>lb mapping level. (I realize that I can change
states via the jkstatus page, but I want the changes to persistent.) 

I think I saw in the bug database discussion of making the
workers.properties dynamically reloadable, and I wanted to cast a vote
for that feature.

Thanks again for everything,

Brian Horblit

-->-----Original Message-----
-->From: Rainer Jung [mailto:rainer.jung@kippdata.de] 
-->Sent: Tuesday, September 18, 2007 11:59 AM
-->To: Tomcat Users List
-->Subject: Re: With JK 1.2.x using route causes problems with redirect?
-->
-->Brian.Horblit@thomson.com wrote:
-->> Henk and Rainer,
-->> 
-->> My sincerest apologies! I don't know how many times I checked that 
-->> config without noticing the error. Sorry to waste your 
-->time. Probably 
-->> too many edits/tests wore my eyes out. :-(
-->
-->No problem. I learned something too (redirect=route), and 
-->found another tester for the domain feature :)
-->
-->> I fixed that domain up and yes indeed, it seems to be 
-->working. I did 6 
-->> combinations of server fails and restarts with the 
-->expected behavior 
-->> each time.
-->> 
-->> Thanks once again,
-->> 
-->> Brian
-->
-->Have fun!
-->
-->Rainer
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: With JK 1.2.x using route causes problems with redirect?

Posted by Rainer Jung <ra...@kippdata.de>.
Brian.Horblit@thomson.com wrote:
> Henk and Rainer,
> 
> My sincerest apologies! I don't know how many times I checked that
> config without noticing the error. Sorry to waste your time. Probably
> too many edits/tests wore my eyes out. :-(

No problem. I learned something too (redirect=route), and found another 
tester for the domain feature :)

> I fixed that domain up and yes indeed, it seems to be working. I did 6
> combinations of server fails and restarts with the expected behavior
> each time. 
> 
> Thanks once again,
> 
> Brian

Have fun!

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.
Henk and Rainer,

My sincerest apologies! I don't know how many times I checked that
config without noticing the error. Sorry to waste your time. Probably
too many edits/tests wore my eyes out. :-(

I fixed that domain up and yes indeed, it seems to be working. I did 6
combinations of server fails and restarts with the expected behavior
each time. 

Thanks once again,

Brian

-->-----Original Message-----
-->From: Rainer Jung [mailto:rainer.jung@kippdata.de] 
-->Sent: Tuesday, September 18, 2007 10:13 AM
-->To: Tomcat Users List
-->Subject: Re: With JK 1.2.x using route causes problems with redirect?
-->
-->Henk Fictorie wrote:
-->> 
-->> Brian.Horblit wrote:
-->>>  
-->>> # Set w4 properties
-->>> worker.w4.socket_keepalive=1
-->>> worker.w4.socket_timeout=20
-->>> worker.w4.reply_timeout=20000
-->>> worker.w4.retries=2
-->>> worker.w4.connection_pool_timeout=60
-->>> worker.w4.type=ajp13
-->>> worker.w4.host=localhost
-->>> worker.w4.port=8034
-->>> worker.w4.lbfactor=1
-->>> worker.w4.route=tc4
-->>> worker.w3.domain=d34
-->>>
-->>>
-->> 
-->> I guess this is a typo, it should be worker.w4.domain=d34
-->> 
-->> regards Henk
-->
-->And I already wondered what the heck was wrong with domains. 
-->Thanks! So
-->Brian: give it another try with the fixed typo. I don't see 
-->anything else wrong in this configuration.
-->
-->Regards
-->
-->Rainer
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: With JK 1.2.x using route causes problems with redirect?

Posted by Rainer Jung <ra...@kippdata.de>.
Henk Fictorie wrote:
> 
> Brian.Horblit wrote:
>>  
>> # Set w4 properties 
>> worker.w4.socket_keepalive=1
>> worker.w4.socket_timeout=20
>> worker.w4.reply_timeout=20000
>> worker.w4.retries=2
>> worker.w4.connection_pool_timeout=60
>> worker.w4.type=ajp13
>> worker.w4.host=localhost
>> worker.w4.port=8034
>> worker.w4.lbfactor=1
>> worker.w4.route=tc4
>> worker.w3.domain=d34
>>
>>
> 
> I guess this is a typo, it should be worker.w4.domain=d34
> 
> regards Henk

And I already wondered what the heck was wrong with domains. Thanks! So 
Brian: give it another try with the fixed typo. I don't see anything 
else wrong in this configuration.

Regards

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Henk Fictorie <he...@kpn.com>.

Brian.Horblit wrote:
> 
>  
> # Set w4 properties 
> worker.w4.socket_keepalive=1
> worker.w4.socket_timeout=20
> worker.w4.reply_timeout=20000
> worker.w4.retries=2
> worker.w4.connection_pool_timeout=60
> worker.w4.type=ajp13
> worker.w4.host=localhost
> worker.w4.port=8034
> worker.w4.lbfactor=1
> worker.w4.route=tc4
> worker.w3.domain=d34
> 
> 

I guess this is a typo, it should be worker.w4.domain=d34

regards Henk
-- 
View this message in context: http://www.nabble.com/With-JK-1.2.x-using-route-causes-problems-with-redirect--tf4467606.html#a12759948
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.
 
Rainer,

How about a "big bug" report? Sorry for the typo ;-)

An update.

With the "route"/"redirect" strategy, I did as you suggested and changed
my "redirect" to the route name rather than the worker name. It now
seems to work as I itended: Failovers are between redirect partners. I
did a good 6 or 7 failures, back and forth, with no "errors." Thanks
very much!

I then went is and simply deleted the "redirect" directive and put in a
"domain" directive. Everything else stayed the same. That is I had
workers w1-w4, each of which had a specified route tc1-tc4. This did not
work. It basically behaved like my "redirect" configuration when I
specified worker names rather than routes for the redirect. At times
fail-overs went outside the domain. My config for this scenario is
below. If I understood your other email, all I needed to change was
swapping domain for redirect and I could leave the routes alone, so that
is what I tried.

Thanks again!

=======
workers.proprties for attempt at using both "domain" and "route"


### Global worker maintenance interval in seconds
worker.maintain=30

###
### The list of all workers
### 
worker.list=router

###
### The real workers
### 
# Set w1 properties 
worker.w1.socket_keepalive=1
worker.w1.socket_timeout=20
worker.w1.reply_timeout=20000
worker.w1.retries=2
worker.w1.connection_pool_timeout=60
worker.w1.type=ajp13
worker.w1.host=localhost
worker.w1.port=8031
worker.w1.lbfactor=1
worker.w1.route=tc1
worker.w1.domain=d12

# Set w2 properties 
worker.w2.socket_keepalive=1
worker.w2.socket_timeout=20
worker.w2.reply_timeout=20000
worker.w2.retries=2
worker.w2.connection_pool_timeout=60
worker.w2.type=ajp13
worker.w2.host=localhost
worker.w2.port=8032
worker.w2.lbfactor=1
worker.w2.route=tc2
worker.w2.domain=d12

# Set w3 properties 
worker.w3.socket_keepalive=1
worker.w3.socket_timeout=20
worker.w3.reply_timeout=20000
worker.w3.retries=2
worker.w3.connection_pool_timeout=60
worker.w3.type=ajp13
worker.w3.host=localhost
worker.w3.port=8033
worker.w3.lbfactor=1
worker.w3.route=tc3
worker.w3.domain=d34

# Set w4 properties 
worker.w4.socket_keepalive=1
worker.w4.socket_timeout=20
worker.w4.reply_timeout=20000
worker.w4.retries=2
worker.w4.connection_pool_timeout=60
worker.w4.type=ajp13
worker.w4.host=localhost
worker.w4.port=8034
worker.w4.lbfactor=1
worker.w4.route=tc4
worker.w3.domain=d34

# router is a load balancer 
worker.router.type=lb
worker.router.balance_workers=w1,w2,w3,w4
worker.router.sticky_session=True
worker.router.sticky_session_force=False
worker.router.method=S
worker.router.recover_time=30

###
### The status worker
### 
worker.list=jkstatus
worker.jkstatus.type=status

  

-->-----Original Message-----
-->From: Rainer Jung [mailto:rainer.jung@kippdata.de] 
-->Sent: Monday, September 17, 2007 11:40 AM
-->To: Tomcat Users List
-->Subject: Re: With JK 1.2.x using route causes problems with redirect?
-->
-->Hi Brian,
-->
-->Brian.Horblit@thomson.com schrieb:
-->> Out of curiosity, is the issue I noted (incorrect 
-->"redirct" failover 
-->> when "route" used) a known issue? Even though it is not 
-->intended usage 
-->> should I submit a big report?
-->
-->I think we neither need a bug report, nor a big report :)
-->
-->Quick shot: redirect needs to be a route, not a worker name. 
-->Since you decided to map routes to workers via the route 
-->attribute, you most likely need to use the route name 
-->instead of the worker name in the redirect attribute. At 
-->least that's how the code looks like.
-->
-->Redirect is older than route, and we didn't think about the 
-->implication, when adding route. It's not bad enough to 
-->justify a bug report, I think.
-->We should note it in the docs though.
-->
-->Let us know, if the resulting configuration works for you 
-->(whatever you prefer, redirect or domain).
-->
-->Regards,
-->
-->Rainer
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: With JK 1.2.x using route causes problems with redirect?

Posted by Rainer Jung <ra...@kippdata.de>.
Rainer Jung schrieb:
> We should note it in the docs though.

I improved the worker reference page for the next release a bit:

Set to the name of the preferred failover worker. If worker matching
SESSION ID is in error state then the redirect worker will be used
instead. It will be used even if being disabled, thus offering hot standby.

If you explicitely set a route via the "route" attribute, you must set
"redirect" to this route of the preferred failover worker and not to its
name.

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: With JK 1.2.x using route causes problems with redirect?

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Brian,

Brian.Horblit@thomson.com schrieb:
> Out of curiosity, is the issue I noted (incorrect "redirct" failover
> when "route" used) a known issue? Even though it is not intended usage
> should I submit a big report?

I think we neither need a bug report, nor a big report :)

Quick shot: redirect needs to be a route, not a worker name. Since you
decided to map routes to workers via the route attribute, you most
likely need to use the route name instead of the worker name in the
redirect attribute. At least that's how the code looks like.

Redirect is older than route, and we didn't think about the implication,
when adding route. It's not bad enough to justify a bug report, I think.
We should note it in the docs though.

Let us know, if the resulting configuration works for you (whatever you
prefer, redirect or domain).

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: With JK 1.2.x using route causes problems with redirect?

Posted by Br...@thomson.com.
Rainer,

Thanks very much for the quick response! You guys are awesome.

So, as I now understand it, the "domain" mechanism is compatable with
(and independent of) the "route". And even if domains are used, the
stickyness of sticky sessions is at the server level since the route is
used to find individual servers. I'll give this a try right away!

Out of curiosity, is the issue I noted (incorrect "redirct" failover
when "route" used) a known issue? Even though it is not intended usage
should I submit a big report?

Thanks very much again - I appreciate the quick and detailed response!

Brian Horblit


-->-----Original Message-----
-->From: Rainer Jung [mailto:rainer.jung@kippdata.de] 
-->Sent: Monday, September 17, 2007 9:56 AM
-->To: Tomcat Users List
-->Subject: Re: With JK 1.2.x using route causes problems with redirect?
-->
-->hi Brian,
-->
-->Brian.Horblit@thomson.com wrote:
-->> All,
-->>  
-->> Good day!
-->>  
-->> For a little background, I'm working on implementing 
-->"sub-clusters" 
-->> with the new connector. That is, I will cluster my Tomcats 
-->in paris to 
-->> keep network traffic/memory usage down. The connector would 
-->> preferrentially fail-over between sub-cluster Tomcat pairs. But if 
-->> both elements of a Tomcat cluster go down, I'd like the 
-->connector to 
-->> fail-over to another sub-cluster (with session loss).
-->>  
-->> I realize that the connector "Domain" directive was meant 
-->for this. My 
-->> reading of the docs, however, would imply that since the 
-->jvmRoute is 
-->> the domain (with sticky sessions), the requests going into 
-->a domain 
-->> would be load-balanced between domain memembers.
-->
-->jvmRoute -> worker.xxx.route
-->domain influences failover decision, as you want it.
-->
-->> This would in turn imply (for
-->> those of us who are paranoid), that we'd have to do synchronous 
-->> session replication at the Tomcat level to *ensure* that 
-->under heavy 
-->> load sessions would be replicated before  a user is 
-->balanced between 
-->> cluster members. This would then, potentially, slow 
-->responses to the 
-->> client since sending the response would be delayed until session 
-->> replication is complete. (Perhaps I should try everything 
-->to confirm 
-->> all this since the docs are a wee bit vagues...) So, I 
-->thought I'd be 
-->> sneaky and try other directives. Hence:
-->
-->You can set jvmRoute to the worker name (or as you suggest 
-->the worker route), use session stickyness and relate 
-->differrent workers by using the same domain name.
-->
-->The if all workers are up, stickyness will be effective, if 
-->a worker dies, JK will choose another worker in the same 
-->domain, and only if the whole domain is dead choose any other worker.
-->
-->I'm pretty sure, that you can simulate this somehow with 
-->"redirect", but the domain concept also works, once you 
-->increase the domain size. At the end both concepts are very similar.
-->
-->> I am trying to use JK 1.2.25 to access Tomcat 6. I am setting up 4 
-->> servers paired in two different clusters at the Tomcat 
-->level. In the 
-->> workers.properties I have:
-->>  
-->> - 4 workers: w1,w2,w3,w4
-->> - All 4 workers are sub-workers of a load balancer called "router"
-->> - The 4 workers are configured as two "pairs" where the 
-->worker pairs 
-->> preferrentially fail-over to each other using the 
-->"redirect" directive.
-->> - In order to prepare for some more exotic configuration, 
-->I have used 
-->> the "route" directive to de-couple the worker name from the 
-->> route/jvmRoute which I use for sticky load balancing.
-->> - The exotic config will be to define multiple load 
-->balancers so I can 
-->> switch them out at runtime via the url=>worker mapping 
-->file (since one 
-->> can't reload the workers.properties file at runtime, which is a 
-->> bummer!).
-->
-->You can do "apachectl graceful". Switching via 
-->uriworkermap.properties should be fine though.
-->
-->> I have found that the "redirect" directive is not working 
-->all the time.
-->> If w1 and w2 are set to preferentially fail-over to each other, it 
-->> does not always happen. For example, if I kill the Tomcat w1 is 
-->> pointing to, the connector will at times fail-over to the 
-->Tomcat w4 is pointing to.
-->>  
-->> If I remove the "route" directive from all workers and ensure the 
-->> worker names match the jvmRoute in Tomcat, all is well - I 
-->don't get 
-->> the incorrect fail-overs. It seems then the "redirect" 
-->pairs always 
-->> failover to each other.
-->>  
-->> Note that the problem seems to appear after I do a failover that 
-->> behaves properly once, restart the failed servers, and try another 
-->> failover test.
-->>  
-->> Is my config incorrect? Do the "route" and "redirect" 
-->directives not 
-->> play well with each other?
-->>  
-->> I've tried this on Windoze (see config below) with all 
-->Tomcats on my 
-->> desktop. I've also tried in on Linux with the Tomcats on 4 
-->different 
-->> servers. Same behaviour.
-->>  
-->> Thanks very much in advance!
-->>  
-->> My workers.properties is as follows:
-->>  
-->> 
-->> ### Global worker maintenance interval in seconds 
-->worker.maintain=30
-->>  
-->> ###
-->> ### The list of all workers
-->> ###
-->> worker.list=router
-->>  
-->> ###
-->> ### The real workers
-->> ###
-->> # Set w1 properties
-->> worker.w1.socket_keepalive=1
-->> worker.w1.socket_timeout=20
-->> worker.w1.reply_timeout=20000
-->> worker.w1.retries=2
-->> worker.w1.connection_pool_timeout=60
-->> worker.w1.type=ajp13
-->> worker.w1.host=localhost
-->> worker.w1.port=8031
-->> worker.w1.lbfactor=1
-->> worker.w1.redirect=w2
-->
-->or better instead of the redirect: worker.w1.domain=tc12
-->
-->> worker.w1.route=tc1
-->>  
-->> # Set w2 properties
-->> worker.w2.socket_keepalive=1
-->> worker.w2.socket_timeout=20
-->> worker.w2.reply_timeout=20000
-->> worker.w2.retries=2
-->> worker.w2.connection_pool_timeout=60
-->> worker.w2.type=ajp13
-->> worker.w2.host=localhost
-->> worker.w2.port=8032
-->> worker.w2.lbfactor=1
-->> worker.w2.redirect=w1
-->
-->or better instead of the redirect: worker.w2.domain=tc12
-->
-->> worker.w2.route=tc2
-->>  
-->> # Set w3 properties
-->> worker.w3.socket_keepalive=1
-->> worker.w3.socket_timeout=20
-->> worker.w3.reply_timeout=20000
-->> worker.w3.retries=2
-->> worker.w3.connection_pool_timeout=60
-->> worker.w3.type=ajp13
-->> worker.w3.host=localhost
-->> worker.w3.port=8033
-->> worker.w3.lbfactor=1
-->> worker.w3.redirect=w4
-->
-->or better instead of the redirect: worker.w3.domain=tc34
-->
-->> worker.w3.route=tc3
-->>  
-->> # Set w4 properties
-->> worker.w4.socket_keepalive=1
-->> worker.w4.socket_timeout=20
-->> worker.w4.reply_timeout=20000
-->> worker.w4.retries=2
-->> worker.w4.connection_pool_timeout=60
-->> worker.w4.type=ajp13
-->> worker.w4.host=localhost
-->> worker.w4.port=8034
-->> worker.w4.lbfactor=1
-->> worker.w4.redirect=w3
-->
-->or better instead of the redirect: worker.w4.domain=tc34
-->
-->> worker.w4.route=tc4
-->>  
-->> # router is a load balancer
-->> worker.router.type=lb
-->> worker.router.balance_workers=w1,w2,w3,w4
-->> worker.router.sticky_session=True
-->> worker.router.sticky_session_force=False
-->> worker.router.method=S
-->> worker.router.recover_time=30
-->
-->
-->You can choose other names as domain names, as long as the 
-->correct pairs 
-->share the same name.
-->
-->> ###
-->> ### The status worker
-->> ### 
-->> worker.list=jkstatus
-->> worker.jkstatus.type=status
-->> 
-->>  
-->> Brian D. Horblit
-->> Senior Principal Engineer
-->> Thomson Healthcare
-->> 
-->> (303) 486-6697
-->> (800) 525-9083 x 6697
-->> www.thomsonhealthcare.com <http://www.thomsonhealthcare.com/> 
-->> brian.horblit@thomson.com
-->
-->Regards,
-->
-->Rainer
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org
-->To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: With JK 1.2.x using route causes problems with redirect?

Posted by Rainer Jung <ra...@kippdata.de>.
hi Brian,

Brian.Horblit@thomson.com wrote:
> All,
>  
> Good day!
>  
> For a little background, I'm working on implementing "sub-clusters" with
> the new connector. That is, I will cluster my Tomcats in paris to keep
> network traffic/memory usage down. The connector would preferrentially
> fail-over between sub-cluster Tomcat pairs. But if both elements of a
> Tomcat cluster go down, I'd like the connector to fail-over to another
> sub-cluster (with session loss).
>  
> I realize that the connector "Domain" directive was meant for this. My
> reading of the docs, however, would imply that since the jvmRoute is the
> domain (with sticky sessions), the requests going into a domain would be
> load-balanced between domain memembers.

jvmRoute -> worker.xxx.route
domain influences failover decision, as you want it.

> This would in turn imply (for
> those of us who are paranoid), that we'd have to do synchronous session
> replication at the Tomcat level to *ensure* that under heavy load
> sessions would be replicated before  a user is balanced between cluster
> members. This would then, potentially, slow responses to the client
> since sending the response would be delayed until session replication is
> complete. (Perhaps I should try everything to confirm all this since the
> docs are a wee bit vagues...) So, I thought I'd be sneaky and try other
> directives. Hence:

You can set jvmRoute to the worker name (or as you suggest the worker 
route), use session stickyness and relate differrent workers by using 
the same domain name.

The if all workers are up, stickyness will be effective, if a worker 
dies, JK will choose another worker in the same domain, and only if the 
whole domain is dead choose any other worker.

I'm pretty sure, that you can simulate this somehow with "redirect", but 
the domain concept also works, once you increase the domain size. At the 
end both concepts are very similar.

> I am trying to use JK 1.2.25 to access Tomcat 6. I am setting up 4
> servers paired in two different clusters at the Tomcat level. In the
> workers.properties I have:
>  
> - 4 workers: w1,w2,w3,w4
> - All 4 workers are sub-workers of a load balancer called "router"
> - The 4 workers are configured as two "pairs" where the worker pairs
> preferrentially fail-over to each other using the "redirect" directive.
> - In order to prepare for some more exotic configuration, I have used
> the "route" directive to de-couple the worker name from the
> route/jvmRoute which I use for sticky load balancing.
> - The exotic config will be to define multiple load balancers so I can
> switch them out at runtime via the url=>worker mapping file (since one
> can't reload the workers.properties file at runtime, which is a
> bummer!).

You can do "apachectl graceful". Switching via uriworkermap.properties 
should be fine though.

> I have found that the "redirect" directive is not working all the time.
> If w1 and w2 are set to preferentially fail-over to each other, it does
> not always happen. For example, if I kill the Tomcat w1 is pointing to,
> the connector will at times fail-over to the Tomcat w4 is pointing to.
>  
> If I remove the "route" directive from all workers and ensure the worker
> names match the jvmRoute in Tomcat, all is well - I don't get the
> incorrect fail-overs. It seems then the "redirect" pairs always failover
> to each other.
>  
> Note that the problem seems to appear after I do a failover that behaves
> properly once, restart the failed servers, and try another failover
> test.
>  
> Is my config incorrect? Do the "route" and "redirect" directives not
> play well with each other?
>  
> I've tried this on Windoze (see config below) with all Tomcats on my
> desktop. I've also tried in on Linux with the Tomcats on 4 different
> servers. Same behaviour.
>  
> Thanks very much in advance!
>  
> My workers.properties is as follows:
>  
> 
> ### Global worker maintenance interval in seconds
> worker.maintain=30
>  
> ###
> ### The list of all workers
> ### 
> worker.list=router
>  
> ###
> ### The real workers
> ### 
> # Set w1 properties 
> worker.w1.socket_keepalive=1
> worker.w1.socket_timeout=20
> worker.w1.reply_timeout=20000
> worker.w1.retries=2
> worker.w1.connection_pool_timeout=60
> worker.w1.type=ajp13
> worker.w1.host=localhost
> worker.w1.port=8031
> worker.w1.lbfactor=1
> worker.w1.redirect=w2

or better instead of the redirect: worker.w1.domain=tc12

> worker.w1.route=tc1
>  
> # Set w2 properties 
> worker.w2.socket_keepalive=1
> worker.w2.socket_timeout=20
> worker.w2.reply_timeout=20000
> worker.w2.retries=2
> worker.w2.connection_pool_timeout=60
> worker.w2.type=ajp13
> worker.w2.host=localhost
> worker.w2.port=8032
> worker.w2.lbfactor=1
> worker.w2.redirect=w1

or better instead of the redirect: worker.w2.domain=tc12

> worker.w2.route=tc2
>  
> # Set w3 properties 
> worker.w3.socket_keepalive=1
> worker.w3.socket_timeout=20
> worker.w3.reply_timeout=20000
> worker.w3.retries=2
> worker.w3.connection_pool_timeout=60
> worker.w3.type=ajp13
> worker.w3.host=localhost
> worker.w3.port=8033
> worker.w3.lbfactor=1
> worker.w3.redirect=w4

or better instead of the redirect: worker.w3.domain=tc34

> worker.w3.route=tc3
>  
> # Set w4 properties 
> worker.w4.socket_keepalive=1
> worker.w4.socket_timeout=20
> worker.w4.reply_timeout=20000
> worker.w4.retries=2
> worker.w4.connection_pool_timeout=60
> worker.w4.type=ajp13
> worker.w4.host=localhost
> worker.w4.port=8034
> worker.w4.lbfactor=1
> worker.w4.redirect=w3

or better instead of the redirect: worker.w4.domain=tc34

> worker.w4.route=tc4
>  
> # router is a load balancer 
> worker.router.type=lb
> worker.router.balance_workers=w1,w2,w3,w4
> worker.router.sticky_session=True
> worker.router.sticky_session_force=False
> worker.router.method=S
> worker.router.recover_time=30


You can choose other names as domain names, as long as the correct pairs 
share the same name.

> ###
> ### The status worker
> ### 
> worker.list=jkstatus
> worker.jkstatus.type=status
> 
>  
> Brian D. Horblit
> Senior Principal Engineer
> Thomson Healthcare
> 
> (303) 486-6697
> (800) 525-9083 x 6697
> www.thomsonhealthcare.com <http://www.thomsonhealthcare.com/> 
> brian.horblit@thomson.com

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org