You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tony Vinayak <tv...@covalent.net> on 2001/09/13 06:04:02 UTC

Multiple Tomcat workers (using mod_jk)

Folks,

I've got a couple of quick newbie questions:
Environment: Apache 1.3.20 on Solaris 8; Tomcat 3.2 (using mod_jk); Apache
and Tomcat running on the same box.

If I configure and run multiple Tomcat workers on the same machine
(listening on different ports of course), and let's say they are all using
ajp13 connector, do all those workers run in the SAME of DIFFERENT VM ?

The reason I ask is that I've got a thread-unsafe servle that I want to
deploy implementing "SingleThreadModel" across multiple concurrent instances
of Tomcat, allowing concurrent requests to be processes. As the request gets
into Apache, using mod_rewrite I want to direct it to one of the several
Tomcat workers.

regards,
Tony


RE: Multiple Tomcat workers (using mod_jk)

Posted by Tony Vinayak <tv...@covalent.net>.
Thanks Jan -- that helps! Especially the bit regarding being able to JkMount
onto the "loadbalancer" worker.

Sooooo...seems like it would be more efficient to create multiple WORKERS of
Tomcat on same/different machines and let the loadbalancer work handle the
load balancing, as opposed to running multiple INSTANCES of Tomcat on
same/different machines and then having to use mod_rewrite to load balance
across them all. The latter approach sounds like not only more work, but
also a greater resource hog.

What I'm trying to accomplish is to run multiple concurrent instances this
thread-unsafe servlet. Ideally I should fix the servlet itself, but don't
have the liberty to do so for several reasons. I'm hoping to be able to
deploy this rogue servlet across multiple Tomcat workers (behind an Apache
web server) and then let the loadbalancer worker handle the request
allocation for me.

Comments, anyone?

regards,
Tony


-----Original Message-----
From: Jan Labanowski [mailto:jkl@osc.edu]
Sent: Thursday, September 13, 2001 12:23 AM
To: tomcat-user@jakarta.apache.org; tvinayak@covalent.net
Subject: Re: Multiple Tomcat workers (using mod_jk)


I am not the developer, so I do not know... But this is what I think:
The workers are different instances of Tomcat, and can reside even on
different machines, i.e., obviously they run under different VMs
At the same time, the load balancing worker should send the request
which belong to the same session to the same worker for processing...
>From what I know, if you configure this right, the Apache talks only to
a single, load-balancing worker, and has no control over which worker
does the actuall processing, unless you mount different contexts to
different
workers, but then you are in control...

But yes, there is a lack of good documentation on doing load balancing with
mod_jk, though there is plenty on mod_jserv.

Here are some excripts from someone who tried this:
=============================
From: "David Cassidy (Programmer)" <dc...@hotgen.com>
To: tomcat-user@jakarta.apache.org
Subject: Re: Tomcat and Apache on diffenet machines
Date: Fri, 25 May 2001 15:10:36 +0100

Yup this is possible ....

and if you are using the loadbalancing module ( so you can have more
than 1
tomcat for your apache(s) to talk to) essential

in workers.properties you should find something like ...

worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1

To define another service try ...

worker.external_1.port=8007
worker.external_1.host=192.168.34.43
worker.external_1.type=ajp12
worker.external_1.lbfactor=1

You can define as many of these as you want.

You can then define a loadbalancer ( if you want to)

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, external_1, external_2 etc

then
worker.list=loadbalancer
and you have got load balancing

If you just want to use a single tomcat host then
worker.list=external_1

in your mod_jk.conf

JkMount /test/* loadbalancer

or

JkMount /test/* external_1
====================================

Jan


On Thu, 13 Sep 2001, Tony Vinayak wrote:

> Folks,
>
> I've got a couple of quick newbie questions:
> Environment: Apache 1.3.20 on Solaris 8; Tomcat 3.2 (using mod_jk); Apache
> and Tomcat running on the same box.
>
> If I configure and run multiple Tomcat workers on the same machine
> (listening on different ports of course), and let's say they are all using
> ajp13 connector, do all those workers run in the SAME of DIFFERENT VM ?
>
> The reason I ask is that I've got a thread-unsafe servle that I want to
> deploy implementing "SingleThreadModel" across multiple concurrent
instances
> of Tomcat, allowing concurrent requests to be processes. As the request
gets
> into Apache, using mod_rewrite I want to direct it to one of the several
> Tomcat workers.
>
> regards,
> Tony
>

Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center    |    Internet: jkl@osc.edu
1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163      |    http://www.osc.edu/



Re: Multiple Tomcat workers (using mod_jk)

Posted by Jan Labanowski <jk...@osc.edu>.
I am not the developer, so I do not know... But this is what I think:
The workers are different instances of Tomcat, and can reside even on
different machines, i.e., obviously they run under different VMs
At the same time, the load balancing worker should send the request
which belong to the same session to the same worker for processing...
>From what I know, if you configure this right, the Apache talks only to
a single, load-balancing worker, and has no control over which worker
does the actuall processing, unless you mount different contexts to different
workers, but then you are in control...

But yes, there is a lack of good documentation on doing load balancing with
mod_jk, though there is plenty on mod_jserv.

Here are some excripts from someone who tried this:
=============================
From: "David Cassidy (Programmer)" <dc...@hotgen.com>
To: tomcat-user@jakarta.apache.org
Subject: Re: Tomcat and Apache on diffenet machines
Date: Fri, 25 May 2001 15:10:36 +0100

Yup this is possible ....
 
and if you are using the loadbalancing module ( so you can have more
than 1
tomcat for your apache(s) to talk to) essential
 
in workers.properties you should find something like ...
 
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
 
To define another service try ...
 
worker.external_1.port=8007
worker.external_1.host=192.168.34.43
worker.external_1.type=ajp12
worker.external_1.lbfactor=1
 
You can define as many of these as you want.
 
You can then define a loadbalancer ( if you want to)
 
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, external_1, external_2 etc
 
then
worker.list=loadbalancer
and you have got load balancing
 
If you just want to use a single tomcat host then
worker.list=external_1
 
in your mod_jk.conf
 
JkMount /test/* loadbalancer
 
or
 
JkMount /test/* external_1
====================================

Jan


On Thu, 13 Sep 2001, Tony Vinayak wrote:

> Folks,
> 
> I've got a couple of quick newbie questions:
> Environment: Apache 1.3.20 on Solaris 8; Tomcat 3.2 (using mod_jk); Apache
> and Tomcat running on the same box.
> 
> If I configure and run multiple Tomcat workers on the same machine
> (listening on different ports of course), and let's say they are all using
> ajp13 connector, do all those workers run in the SAME of DIFFERENT VM ?
> 
> The reason I ask is that I've got a thread-unsafe servle that I want to
> deploy implementing "SingleThreadModel" across multiple concurrent instances
> of Tomcat, allowing concurrent requests to be processes. As the request gets
> into Apache, using mod_rewrite I want to direct it to one of the several
> Tomcat workers.
> 
> regards,
> Tony
> 

Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center    |    Internet: jkl@osc.edu 
1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163      |    http://www.osc.edu/