You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Alberts <ta...@msiscales.com> on 2007/05/31 22:09:58 UTC

Load Balance sticky_session=True, am I missing something?

I have two tomcat servers (5.5.23) and running mod_jk (1.2.20) with load 
balancing behind apache.  I have a web application that needs to 
maintain session information.  What I'm seeing is that the load balance 
is alternating requests between the servers equally, as expected, but 
sessions are getting lost when going between the servers.  I thought 
from reading that the default is sticky_session=True which means the 
mod_jk will keep sessions going to the same server (if it is 
available..).  This is obviously not happening.  Am I doing something 
wrong, or is there a problem?

# workers.properties - ajp13
#
# List workers
worker.list=lb,jkstatus
#
# Define wrkr1
worker.wrkr1.port=8009
worker.wrkr1.host=msi1
worker.wrkr1.type=ajp13
worker.wrkr1.socket_timeout=300
worker.wrkr1.lbfactor=1
#
# Define wrkr2
worker.wrkr2.port=8009
worker.wrkr2.host=msi2
worker.wrkr2.type=ajp13
worker.wrkr2.socket_timeout=300
worker.wrkr2.lbfactor=1
#
# Define lb
worker.lb.type=lb
worker.lb.sticky_session=True
worker.lb.sticky_session_force=False
worker.lb.balanced_workers=wrkr1,wrkr2
#
# Define a 'jkstatus' worker using status
worker.jkstatus.type=status

Second, I see a reference to a Session Manager in the Tomcat 
documentation that can maintain session data across multiple servers.  
This is the first I've heard about this, is this something Tomcat has 
built in that I need to enable, or is this third party or something I 
need to write on my own?  (I will be reading more, but quick info from 
users is helpful).

Thank you for any help.



---------------------------------------------------------------------
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: Load Balance sticky_session=True, am I missing something?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Tim... it looks almost right, I took snippets from some of my configs that 
work
... where I could see a difference.

Tomcat has has a built in load balancing option... that needs the session 
persistance that
you thinking about... you dont need it for the JK arrangement. They 2 
difference schemes.



----- Original Message ----- 
From: "Tim Alberts" <ta...@msiscales.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, May 31, 2007 10:52 PM
Subject: Re: Load Balance sticky_session=True, am I missing something?


> Well I found one problem with my workers.properties, but it didn't fix my 
> problem.  I used the deprecated 'balanced_workers' on my load balancer 
> configuration instead of the balance_workers. So I'm still stuck, any 
> suggestions?
>
>
> Tim Alberts wrote:
>> I have two tomcat servers (5.5.23) and running mod_jk (1.2.20) with load 
>> balancing behind apache.  I have a web application that needs to maintain 
>> session information.  What I'm seeing is that the load balance is 
>> alternating requests between the servers equally, as expected, but 
>> sessions are getting lost when going between the servers.  I thought from 
>> reading that the default is sticky_session=True which means the mod_jk 
>> will keep sessions going to the same server (if it is available..).  This 
>> is obviously not happening.  Am I doing something wrong, or is there a 
>> problem?
>>
>> # workers.properties - ajp13
>> #
>> # List workers
>> worker.list=lb,jkstatus
>> #
>> # Define wrkr1
>> worker.wrkr1.port=8009
>> worker.wrkr1.host=msi1
>> worker.wrkr1.type=ajp13
>> worker.wrkr1.socket_timeout=300
>> worker.wrkr1.lbfactor=1
worker.worker1.lbfactor=50
>> #
>> # Define wrkr2
>> worker.wrkr2.port=8009
>> worker.wrkr2.host=msi2
>> worker.wrkr2.type=ajp13
>> worker.wrkr2.socket_timeout=300
>> worker.wrkr2.lbfactor=1

worker.worker1.lbfactor=50

>> #
>> # Define lb
>> worker.lb.type=lb
>> worker.lb.sticky_session=True
>> worker.lb.sticky_session_force=False
>> worker.lb.balanced_workers=wrkr1,wrkr2


#try both these
worker.lb.sticky_session=1
worker.lb.sticky_session=true
worker.lb.sticky_session_force=false


>> #
>> # Define a 'jkstatus' worker using status
>> worker.jkstatus.type=status
>>
>> Second, I see a reference to a Session Manager in the Tomcat 
>> documentation that can maintain session data across multiple servers. 
>> This is the first I've heard about this, is this something Tomcat has 
>> built in that I need to enable, or is this third party or something I 
>> need to write on my own?  (I will be reading more, but quick info from 
>> users is helpful).
>>
>> Thank you for any help.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Load Balance sticky_session=True, am I missing something?

Posted by Rainer Jung <ra...@kippdata.de>.
Unfortunately most of the generic HowTos are very outdated. If you like 
to contribute a docs patch:

http://tomcat.apache.org/connectors-doc/miscellaneous/doccontrib.html

Regards,

Rainer

Tim Alberts wrote:
> That's what I was missing, thank you.  Although I think adding a 
> reference to this in the mod_jk configuration might be helpful?  Say 
> somewhere in the page:
> 
> http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html
> 
> 
> 
> 
> Rainer Jung wrote:
>> Concerning the load balancer worker: you need to set jvmRoute in 
>> server.xml on your Tomcat servers. The value of the respective 
>> jvmRoute has to be wrkr1 and wrkr2.
>>
>> This will add that string to the session id (JSESSSIONID cookie or 
>> jsessionid= URL part) and mod_jk strips it from there to learn, where 
>> the sticky request should go to.
>>
>> 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: Load Balance sticky_session=True, am I missing something?

Posted by Tim Alberts <ta...@msiscales.com>.
That's what I was missing, thank you.  Although I think adding a 
reference to this in the mod_jk configuration might be helpful?  Say 
somewhere in the page:

http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html




Rainer Jung wrote:
> Concerning the load balancer worker: you need to set jvmRoute in 
> server.xml on your Tomcat servers. The value of the respective 
> jvmRoute has to be wrkr1 and wrkr2.
>
> This will add that string to the session id (JSESSSIONID cookie or 
> jsessionid= URL part) and mod_jk strips it from there to learn, where 
> the sticky request should go to.
>
> 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: Load Balance sticky_session=True, am I missing something?

Posted by Rainer Jung <ra...@kippdata.de>.
Concerning the load balancer worker: you need to set jvmRoute in 
server.xml on your Tomcat servers. The value of the respective jvmRoute 
has to be wrkr1 and wrkr2.

This will add that string to the session id (JSESSSIONID cookie or 
jsessionid= URL part) and mod_jk strips it from there to learn, where 
the sticky request should go to.

Regards,

Rainer

Tim Alberts wrote:
> Well I found one problem with my workers.properties, but it didn't fix 
> my problem.  I used the deprecated 'balanced_workers' on my load 
> balancer configuration instead of the balance_workers. So I'm still 
> stuck, any suggestions?
> 
> 
> Tim Alberts wrote:
>> I have two tomcat servers (5.5.23) and running mod_jk (1.2.20) with 
>> load balancing behind apache.  I have a web application that needs to 
>> maintain session information.  What I'm seeing is that the load 
>> balance is alternating requests between the servers equally, as 
>> expected, but sessions are getting lost when going between the 
>> servers.  I thought from reading that the default is 
>> sticky_session=True which means the mod_jk will keep sessions going to 
>> the same server (if it is available..).  This is obviously not 
>> happening.  Am I doing something wrong, or is there a problem?
>>
>> # workers.properties - ajp13
>> #
>> # List workers
>> worker.list=lb,jkstatus
>> #
>> # Define wrkr1
>> worker.wrkr1.port=8009
>> worker.wrkr1.host=msi1
>> worker.wrkr1.type=ajp13
>> worker.wrkr1.socket_timeout=300
>> worker.wrkr1.lbfactor=1
>> #
>> # Define wrkr2
>> worker.wrkr2.port=8009
>> worker.wrkr2.host=msi2
>> worker.wrkr2.type=ajp13
>> worker.wrkr2.socket_timeout=300
>> worker.wrkr2.lbfactor=1
>> #
>> # Define lb
>> worker.lb.type=lb
>> worker.lb.sticky_session=True
>> worker.lb.sticky_session_force=False
>> worker.lb.balanced_workers=wrkr1,wrkr2
>> #
>> # Define a 'jkstatus' worker using status
>> worker.jkstatus.type=status
>>
>> Second, I see a reference to a Session Manager in the Tomcat 
>> documentation that can maintain session data across multiple servers.  
>> This is the first I've heard about this, is this something Tomcat has 
>> built in that I need to enable, or is this third party or something I 
>> need to write on my own?  (I will be reading more, but quick info from 
>> users is helpful).
>>
>> Thank you for any help.

---------------------------------------------------------------------
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: Load Balance sticky_session=True, am I missing something?

Posted by Tim Alberts <ta...@msiscales.com>.
Well I found one problem with my workers.properties, but it didn't fix 
my problem.  I used the deprecated 'balanced_workers' on my load 
balancer configuration instead of the balance_workers. So I'm still 
stuck, any suggestions?


Tim Alberts wrote:
> I have two tomcat servers (5.5.23) and running mod_jk (1.2.20) with 
> load balancing behind apache.  I have a web application that needs to 
> maintain session information.  What I'm seeing is that the load 
> balance is alternating requests between the servers equally, as 
> expected, but sessions are getting lost when going between the 
> servers.  I thought from reading that the default is 
> sticky_session=True which means the mod_jk will keep sessions going to 
> the same server (if it is available..).  This is obviously not 
> happening.  Am I doing something wrong, or is there a problem?
>
> # workers.properties - ajp13
> #
> # List workers
> worker.list=lb,jkstatus
> #
> # Define wrkr1
> worker.wrkr1.port=8009
> worker.wrkr1.host=msi1
> worker.wrkr1.type=ajp13
> worker.wrkr1.socket_timeout=300
> worker.wrkr1.lbfactor=1
> #
> # Define wrkr2
> worker.wrkr2.port=8009
> worker.wrkr2.host=msi2
> worker.wrkr2.type=ajp13
> worker.wrkr2.socket_timeout=300
> worker.wrkr2.lbfactor=1
> #
> # Define lb
> worker.lb.type=lb
> worker.lb.sticky_session=True
> worker.lb.sticky_session_force=False
> worker.lb.balanced_workers=wrkr1,wrkr2
> #
> # Define a 'jkstatus' worker using status
> worker.jkstatus.type=status
>
> Second, I see a reference to a Session Manager in the Tomcat 
> documentation that can maintain session data across multiple servers.  
> This is the first I've heard about this, is this something Tomcat has 
> built in that I need to enable, or is this third party or something I 
> need to write on my own?  (I will be reading more, but quick info from 
> users is helpful).
>
> Thank you for any help.
>
>
>
> ---------------------------------------------------------------------
> 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