tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: Unable to acheive load balcing using mod_jk
Date Tue, 07 Sep 2010 09:32:08 GMT
On 07.09.2010 11:15, Mladen Turk wrote:
> On 09/07/2010 11:02 AM, Amol Puglia wrote:
>> Hello Team,
>>
>> Below are the details of workers.properties file and httpd.conf file.
>>
>> # lists the workers by name
>>
>> worker.list=tomcat1, tomcat2, tomcat3, loadbalancer
>>
>
> This should be
> worker.list=loadbalancer
>
> Note that workers that constitute load balancer must
> not appear in the worker.list

In addition:

if you start a fresh install, use recent versions:

Tomcat 6.0.29
mod_jk 1.2.30
Apache 2.2.16 or 2.0.63

I don't know, what your actual problem is, but if it is session 
stickyness, then read on.

In order to make sticky session work, you need two ingredients.

1) You need to set the attribute jvmRoute in server.xml of each Tomcat 
instance to a unique value, something like your logical instance name. 
An example for setting jvmRoute is contained as a comment in the 
default server.xml file. The file is contained in the conf directory of 
Tomcat.

2) Configure a worker of type "lb" (load balancer), with one member 
worker per Tomcat instance. The member workers of the load balancer 
worker need to have the same names as the jvmRoute of the Tomcat to 
which they connect. In your above configuration those names are 
"tomcat1", "tomcat2", ..., so either you choose "tomcat1", "tomcat2", 
... as the jvmRoute values, or you change the names of the workers above 
to the jvmRoute values you have already chosen. By default lb workers 
handle session sticky (unless you turn that off by sticky_session=0, 
something you don't want to). Now map your URLs to the lb worker using 
JkMount.

How does it work?

a) Tomcat automatically appends its own jvmRoute at the end of the 
session id, separated with a dot. The session id is send to the client 
either via the JSESSIONID cookie, or via URL encoding 
("...;jsessionid=...").

b) mod_jk knows about that, extracts the value of the JSESSIONID cookie 
presented by the browser respectively extracts the id encoded in the 
URL, looks for the separating dot and extracts the jvmRoute from the id. 
The load balancing worker then searches for a member worker with the 
same name and uses that one for stickyness.

c) Any request without session id is balanced nonsticky depending on 
configuration and load.

Regards,

Rainer

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


Mime
View raw message