You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mladen Turk <mt...@apache.org> on 2010/09/07 11:15:11 UTC

Re: Unable to acheive load balcing using mod_jk

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


Regards
-- 
^TM

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


Re: Unable to acheive load balcing using mod_jk

Posted by Brett Delle Grazie <br...@intact-is.com>.
On Tue, 2010-09-07 at 17:11 +0200, Rainer Jung wrote:
> On 07.09.2010 17:04, Brett Delle Grazie wrote:
> > On Tue, 2010-09-07 at 11:15 +0200, 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
> >
> > May I ask what might happen if they were?
> >
> > For example, I have two separate vhosts, one which uses the balancer and
> > one (for jk-manager access) which does not, both use sticky sessions -
> > would this cause problems with the balancer code?
> 
> No. It might only confuse people reading the config wondering which of 
> it is used. As long as you get your JkMount right, mod_jk uses the 
> worker you expect.

Thanks - I thought that this might be related to my other cpong issue.

> 
> No idea, what your vhosts have to do with putting the above mentioned 
> ajp workers (tomcat1 etc.) into worker.list though. A vhost for 
> jk-manager access only needs to use one worker, namely a worker of type 
> status. That one needs to be put into the worker.list.

Its actually because of a monitoring tool within the real webapp. We use
different vhosts (and ACL rules) to ensure the outside world can't get
access to the monitoring part.

> BTW: version 1.2.30 contains a nice default configuration in its source 
> download tarball. It shows using load balancer and status worker fer 
> example.

And that is the one I have used :)

> 
> Regards,
> 
> Rainer
> 
> 
Thanks again.

-- 
Best Regards,

Brett Delle Grazie

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

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


Re: Unable to acheive load balcing using mod_jk

Posted by Rainer Jung <ra...@kippdata.de>.
On 07.09.2010 17:04, Brett Delle Grazie wrote:
> On Tue, 2010-09-07 at 11:15 +0200, 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
>
> May I ask what might happen if they were?
>
> For example, I have two separate vhosts, one which uses the balancer and
> one (for jk-manager access) which does not, both use sticky sessions -
> would this cause problems with the balancer code?

No. It might only confuse people reading the config wondering which of 
it is used. As long as you get your JkMount right, mod_jk uses the 
worker you expect.

No idea, what your vhosts have to do with putting the above mentioned 
ajp workers (tomcat1 etc.) into worker.list though. A vhost for 
jk-manager access only needs to use one worker, namely a worker of type 
status. That one needs to be put into the worker.list.

BTW: version 1.2.30 contains a nice default configuration in its source 
download tarball. It shows using load balancer and status worker fer 
example.

Regards,

Rainer


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


Re: Unable to acheive load balcing using mod_jk

Posted by Brett Delle Grazie <br...@intact-is.com>.
On Tue, 2010-09-07 at 11:15 +0200, 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

May I ask what might happen if they were?

For example, I have two separate vhosts, one which uses the balancer and
one (for jk-manager access) which does not, both use sticky sessions -
would this cause problems with the balancer code?

> 
> 
> Regards

Thanks

-- 
Best Regards,

Brett Delle Grazie

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

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


Re: Unable to acheive load balcing using mod_jk

Posted by Rainer Jung <ra...@kippdata.de>.
On 07.09.2010 12:40, Amol Puglia wrote:
> Hello Team,
>
> After making changes to worker list as mentioned in the below mail.
>
> worker.list=loadbalancer.
>
> We are noticing following messages in the log files and we are getting 500 error messages while accessing URL.
>
> [Tue Sep 07 12:34:52.904 2010] [15711:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer
> [Tue Sep 07 12:34:58.630 2010] [15712:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer
> [Tue Sep 07 12:39:48.018 2010] [15711:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer

Looks like your Tomcat sends responses with HTTP Status 500 (internal 
server error) and no response body.

Doesn't look like a mod_jk problem. Look ate your application and Tomcat 
logs.

Regards,

Rainer

> --- On Tue, 9/7/10, Rainer Jung<ra...@kippdata.de>  wrote:
>
> From: Rainer Jung<ra...@kippdata.de>
> Subject: Re: Unable to acheive load balcing using mod_jk
> To: "Tomcat Users List"<us...@tomcat.apache.org>
> Date: Tuesday, September 7, 2010, 3:02 PM
>
> 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


Re: Unable to acheive load balcing using mod_jk

Posted by Amol Puglia <am...@yahoo.com>.
Hello Team,

After making changes to worker list as mentioned in the below mail.

worker.list=loadbalancer.

We are noticing following messages in the log files and we are getting 500 error messages while accessing URL.

[Tue Sep 07 12:34:52.904 2010] [15711:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer
[Tue Sep 07 12:34:58.630 2010] [15712:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer
[Tue Sep 07 12:39:48.018 2010] [15711:27] [info] jk_handler::mod_jk.c (2254): No body with status=500 for worker=loadbalancer



--- On Tue, 9/7/10, Rainer Jung <ra...@kippdata.de> wrote:

From: Rainer Jung <ra...@kippdata.de>
Subject: Re: Unable to acheive load balcing using mod_jk
To: "Tomcat Users List" <us...@tomcat.apache.org>
Date: Tuesday, September 7, 2010, 3:02 PM

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




      

Re: Unable to acheive load balcing using mod_jk

Posted by Rainer Jung <ra...@kippdata.de>.
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