You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sng Wee Jim <We...@capco.com> on 2005/03/01 11:08:59 UTC

session load-balancing and clustering of tomcat

Hi,



I am using tomcat 5.0.28.



My question is how to setup sticky-session load-balancing and clustering
of tomcat?





Do I need to upgrade to tomcat 5.5.X? Note the requirement is on
sticky-session.



- Jim






************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorized. If you are not
an intended recipient, please notify the sender of this email
immediately. You should not copy, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.

http://www.capco.com/

************************************************************************

Re: session load-balancing and clustering of tomcat

Posted by Lionel Farbos <li...@free.fr>.
On Tue, 01 Mar 2005 17:55:15 +0100
Mladen Turk <ml...@jboss.com> wrote:

> Lionel Farbos wrote:
> > 2) then add the module mod_jk in apache
> > with jk workers defined like this :
> > 
> > worker.list=t1_ajp13,t2_ajp13,loadbalancer
> >
> 
> This is not quite correct, although it will work.
> You should set worker.list only for workers that
> have JkMount directive registered.
> Also workers that are member of load balancer
> *should* not be listed within worker.list
> 
I put this example because it can be useful for maintenance
(the JkMount directive at the instant t is possibly not the same as at the instant t+x)

Example :
My webapp "testAppli" is now loadbalanced on hosts h1 and h2.
If want to upgrade my webapp "testAppli".
So,
1) I mono-balance testAppli on h2 (with JkMount /*.jsp h2 + apache reload)
2) I restart testAppli on the Tomcat_h1 instance
3) I mono-balance testAppli on h1 
4) I restart testAppli on the Tomcat_h2 instance
5) I re-loadbalance testAppli

With this principle + mod_jk 1.2.9 (with dynamic change of properties) + a graceful restart of Context
I hope upgrading my webapp transparently (without interruptions)...

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


Re: session load-balancing and clustering of tomcat

Posted by Mladen Turk <ml...@jboss.com>.
Lionel Farbos wrote:
> 1) In server.xml :
> 
> - uncomment the AJP 1.3 Connector (on port 8009),
> - set the jvmRoute in each Engine
> example : <Engine name="Standalone" defaultHost="host1" debug="0" jvmRoute="t1_ajp13">
>

Session route *must* consists only of alphanumeric characters.
See the:
http://jakarta.apache.org/tomcat/connectors-doc/config/workers.html

Later mod_jk releases will have that as prerequisite so that we
don't need to url encode session routes.


> 2) then add the module mod_jk in apache
> with jk workers defined like this :
> 
> worker.list=t1_ajp13,t2_ajp13,loadbalancer
>

This is not quite correct, although it will work.
You should set worker.list only for workers that
have JkMount directive registered.
Also workers that are member of load balancer
*should* not be listed within worker.list

Regards,
Mladen.

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


RE: session load-balancing and clustering of tomcat

Posted by Marc Wiatrowski <wi...@iglass.net>.
My gotcha was setting the jvmRoute in EACH/EVERY Engine! 

> -----Original Message-----
> From: Lionel Farbos [mailto:lionel.farbos@free.fr] 
> Sent: Tuesday, March 01, 2005 8:20 AM
> To: Tomcat Users List
> Cc: Wee.Jim.Sng@capco.com
> Subject: Re: session load-balancing and clustering of tomcat
> 
> 1) In server.xml :
> 
> - uncomment the AJP 1.3 Connector (on port 8009),
> - set the jvmRoute in each Engine
> example : <Engine name="Standalone" defaultHost="host1" 
> debug="0" jvmRoute="t1_ajp13">
> 
> 2) then add the module mod_jk in apache
> with jk workers defined like this :
> 
> worker.list=t1_ajp13,t2_ajp13,loadbalancer
> 
> worker.t1_ajp13.type=ajp13
> worker.t1_ajp13.host=host1
> worker.t1_ajp13.port=8009
> worker.t1_ajp13.lbfactor=1
> worker.t1_ajp13.socket_timeout=5
> worker.t1_ajp13.recycle_timeout=10
> 
> worker.t2_ajp13.type=ajp13
> worker.t2_ajp13.host=host2
> worker.t2_ajp13.port=8009
> worker.t2_ajp13.lbfactor=1
> worker.t2_ajp13.socket_timeout=5
> worker.t2_ajp13.recycle_timeout=10
> 
> worker.loadbalancer.type=lb
> worker.loadbalancer.balanced_workers= t1_ajp13,t2_ajp13
> 
> then, you can load-balance your virtual host like this :
> JkMount /*.jsp loadbalancer
> 
> 3) Conclusion :
> Thanks to mod_jk, you'll have load-balancing (with sticky 
> sessions with JSESSION_ID like this : xxxxx.t1_ajp13 or 
> yyyyy.t2_ajp13), and failover.
> 
> This feature work with all tomcats (TC3.3->TC5)
>  
> On Tue, 1 Mar 2005 18:08:59 +0800
> "Sng Wee Jim" <We...@capco.com> wrote:
> 
> > 
> > Hi,
> > 
> > 
> > 
> > I am using tomcat 5.0.28.
> > 
> > 
> > 
> > My question is how to setup sticky-session load-balancing 
> and clustering
> > of tomcat?
> > 
> > 
> > 
> > 
> > 
> > Do I need to upgrade to tomcat 5.5.X? Note the requirement is on
> > sticky-session.
> > 
> > 
> > 
> > - Jim
> > 
> > 
> > 



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


Re: session load-balancing and clustering of tomcat

Posted by Lionel Farbos <li...@free.fr>.
1) In server.xml :

- uncomment the AJP 1.3 Connector (on port 8009),
- set the jvmRoute in each Engine
example : <Engine name="Standalone" defaultHost="host1" debug="0" jvmRoute="t1_ajp13">

2) then add the module mod_jk in apache
with jk workers defined like this :

worker.list=t1_ajp13,t2_ajp13,loadbalancer

worker.t1_ajp13.type=ajp13
worker.t1_ajp13.host=host1
worker.t1_ajp13.port=8009
worker.t1_ajp13.lbfactor=1
worker.t1_ajp13.socket_timeout=5
worker.t1_ajp13.recycle_timeout=10

worker.t2_ajp13.type=ajp13
worker.t2_ajp13.host=host2
worker.t2_ajp13.port=8009
worker.t2_ajp13.lbfactor=1
worker.t2_ajp13.socket_timeout=5
worker.t2_ajp13.recycle_timeout=10

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers= t1_ajp13,t2_ajp13

then, you can load-balance your virtual host like this :
JkMount /*.jsp loadbalancer

3) Conclusion :
Thanks to mod_jk, you'll have load-balancing (with sticky sessions with JSESSION_ID like this : xxxxx.t1_ajp13 or yyyyy.t2_ajp13), and failover.

This feature work with all tomcats (TC3.3->TC5)
 
On Tue, 1 Mar 2005 18:08:59 +0800
"Sng Wee Jim" <We...@capco.com> wrote:

> 
> Hi,
> 
> 
> 
> I am using tomcat 5.0.28.
> 
> 
> 
> My question is how to setup sticky-session load-balancing and clustering
> of tomcat?
> 
> 
> 
> 
> 
> Do I need to upgrade to tomcat 5.5.X? Note the requirement is on
> sticky-session.
> 
> 
> 
> - Jim
> 
> 
> 
> 
> 
> 
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorized. If you are not
> an intended recipient, please notify the sender of this email
> immediately. You should not copy, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual
> sender, except where the sender specifically states them to be
> the views of Capco.
> 
> http://www.capco.com/
> 
> ************************************************************************

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