You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matt Raible <ma...@raibledesigns.com> on 2002/09/26 00:35:31 UTC

Apache 2.x and Tomcat 4.x - AJP or mod_webapp

I'm trying to create different instances of Tomcat similar to what my
ISP has.  I think they have an Apache front-end and each user gets their
own instance of Tomcat and JVM.  I want to setup this same thing for a
client I have - and I *hope* to make it run on OS X, Windows (2000/XP)
and Linux (Red Hat 7.3).  Linux is their production platform.

I read this article (http://www.ubeans.com/tomcat/) which details how to
do it with the AJP connector.  I think I read that the WARP connector is
not supported on Windows - is this true?  What do you veterans
recommend?  We've got a fresh server and our application works across
all 4.x versions of Tomcat, so I'd like to use the latest stuff.

Some interesting stuff from the article:
----------------------------------------
Question 1:
Why did you choose to use the AJP13 connector rather than the WARP
connector that is recommended? 

Answer:
The warp connector is used in conjunction with mod_webapp, and
mod_webapp does not currently support load balancing. 

Also, I found the documentation for the warp connector on the Jakarta
web site to be quite lacking. See:
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/warp.html 

I know that the future lies in the warp connector, but in the meantime,
I needed something. The documentation did not explain to me exactly what
benefits I would get from using the Warp connector as opposed to AJP13. 

Question 2:
You might specify that creating two instances of the tomcat installation
is not needed as you can share the main binaries and libs by specifying
2 distinct CATALINA_BASE variables. 

True, but in real life the two tomcat servers are usually located on two
different machines. My setup might be overkill for a single machine
setup, but it's easy to tar up the "tomcat2" server and put it on a
second machine; you just have to change "localhost" to the appropriate
machine name in /usr/local/apache/conf/workers.properties and you're
done. 

Question 3:
What does not work and what does work in load balancing? 

Answer:
Load balancing works great. 

1. Session affinity works
Which means that when a client browser is directed to a Tomcat server by
the load balancer, then future queries from that same browser session
will always be directed to the same tomcat server. This is important
because sessions that are created in a specific tomcat server, say
"tomcat1", do not exist in the other server "tomcat2", and thus if the
client was directed to another tomcat server than the one where his
session is stored, then all his session data would be lost. 

Some people are working on sessions that will be replicated across all
tomcat servers in the cluster, so I'll just wait for it to become
available rather than make a homebrewed distributed session mechanism. 

The downside of not having sessions replicated across all the tomcat
servers in the cluster is that if one tomcat server dies, all the
sessions that it contained are lost, which usually makes a lot of
unhappy users. 

2. Failover works
If one tomcat server dies, the load balancer then "rebalances" the
queries to the remaining tomcat servers. 

3. Failback works
When a tomcat server comes back from the dead, the load balancer
automatically starts to send queries to it. So you can actually add
capacity to your cluster on the fly. 

4. Weighted load balancing works
In /usr/local/apache/conf/workers.properties, I assigned a load
balancing factor of 100 to both "tomcat1" and "tomcat2" servers. Then I
changed the lbfactor of "tomcat1" to 101, and I saw that effectively the
"tomcat1" server received more load than the "tomcat2" server, which is
something you want when for example your "tomcat1" server is a
faster/newer machine while your "tomcat2" server is a slower machine
which cannnot take as much load as the other one. 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Apache 2.x and Tomcat 4.x - AJP or mod_webapp

Posted by Matt Raible <ma...@raibledesigns.com>.
The article I read did not mention anything about virtual hosts.  My
main problem now is just starting apache, which I've detailed in a
previous e-mail.

Matt

> -----Original Message-----
> From: Scott Jones [mailto:scott@on-sitemanager.com] 
> Sent: Wednesday, September 25, 2002 7:31 PM
> To: Tomcat Users List
> Cc: Matt Raible
> Subject: Re: Apache 2.x and Tomcat 4.x - AJP or mod_webapp
> 
> 
> Hi Matt,
> 
> I've got mulitple instances of Tomcat running with Apache 
> using AJP (on linux, but should work basically the same on windows).  
> 
> 1.) You need to configure your apache to do virtual hosts 
> (have you done this yet).
> 2.) Set up your workers.properties file (used and read by 
> apache to connect to tomcat using mod_jk) to have several 
> workers.  Then set up your instances of tomcat with different 
> ports in their server.xml configurations (different ports for 
> the shutdown port and for the AJP13 port -- you won't need 
> anything else).
> 
> Cheers,
> 
> Scott
> 
> On Wed, 2002-09-25 at 15:35, Matt Raible wrote:
> > I'm trying to create different instances of Tomcat similar 
> to what my 
> > ISP has.  I think they have an Apache front-end and each user gets 
> > their own instance of Tomcat and JVM.  I want to setup this 
> same thing 
> > for a client I have - and I *hope* to make it run on OS X, Windows 
> > (2000/XP) and Linux (Red Hat 7.3).  Linux is their production 
> > platform.
> > 
> > I read this article (http://www.ubeans.com/tomcat/) which 
> details how 
> > to do it with the AJP connector.  I think I read that the WARP 
> > connector is not supported on Windows - is this true?  What do you 
> > veterans recommend?  We've got a fresh server and our application 
> > works across all 4.x versions of Tomcat, so I'd like to use 
> the latest 
> > stuff.
> > 
> > Some interesting stuff from the article:
> > ----------------------------------------
> > Question 1:
> > Why did you choose to use the AJP13 connector rather than the WARP 
> > connector that is recommended?
> > 
> > Answer:
> > The warp connector is used in conjunction with mod_webapp, and 
> > mod_webapp does not currently support load balancing.
> > 
> > Also, I found the documentation for the warp connector on 
> the Jakarta 
> > web site to be quite lacking. See: 
> > http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/warp.html
> > 
> > I know that the future lies in the warp connector, but in the 
> > meantime, I needed something. The documentation did not 
> explain to me 
> > exactly what benefits I would get from using the Warp connector as 
> > opposed to AJP13.
> > 
> > Question 2:
> > You might specify that creating two instances of the tomcat 
> > installation is not needed as you can share the main 
> binaries and libs 
> > by specifying 2 distinct CATALINA_BASE variables.
> > 
> > True, but in real life the two tomcat servers are usually 
> located on 
> > two different machines. My setup might be overkill for a single 
> > machine setup, but it's easy to tar up the "tomcat2" server 
> and put it 
> > on a second machine; you just have to change "localhost" to the 
> > appropriate machine name in 
> /usr/local/apache/conf/workers.properties 
> > and you're done.
> > 
> > Question 3:
> > What does not work and what does work in load balancing?
> > 
> > Answer:
> > Load balancing works great.
> > 
> > 1. Session affinity works
> > Which means that when a client browser is directed to a 
> Tomcat server 
> > by the load balancer, then future queries from that same browser 
> > session will always be directed to the same tomcat server. This is 
> > important because sessions that are created in a specific tomcat 
> > server, say "tomcat1", do not exist in the other server 
> "tomcat2", and 
> > thus if the client was directed to another tomcat server 
> than the one 
> > where his session is stored, then all his session data 
> would be lost.
> > 
> > Some people are working on sessions that will be replicated 
> across all 
> > tomcat servers in the cluster, so I'll just wait for it to become 
> > available rather than make a homebrewed distributed session 
> mechanism.
> > 
> > The downside of not having sessions replicated across all 
> the tomcat 
> > servers in the cluster is that if one tomcat server dies, all the 
> > sessions that it contained are lost, which usually makes a lot of 
> > unhappy users.
> > 
> > 2. Failover works
> > If one tomcat server dies, the load balancer then "rebalances" the 
> > queries to the remaining tomcat servers.
> > 
> > 3. Failback works
> > When a tomcat server comes back from the dead, the load balancer 
> > automatically starts to send queries to it. So you can actually add 
> > capacity to your cluster on the fly.
> > 
> > 4. Weighted load balancing works
> > In /usr/local/apache/conf/workers.properties, I assigned a load 
> > balancing factor of 100 to both "tomcat1" and "tomcat2" 
> servers. Then 
> > I changed the lbfactor of "tomcat1" to 101, and I saw that 
> effectively 
> > the "tomcat1" server received more load than the "tomcat2" server, 
> > which is something you want when for example your "tomcat1" 
> server is 
> > a faster/newer machine while your "tomcat2" server is a 
> slower machine 
> > which cannnot take as much load as the other one.
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:tomcat-user-> unsubscribe@jakarta.apache.org>
> > For 
> additional commands, 
> e-mail: 
> > <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Apache 2.x and Tomcat 4.x - AJP or mod_webapp

Posted by Scott Jones <sc...@on-sitemanager.com>.
Hi Matt,

I've got mulitple instances of Tomcat running with Apache using AJP (on
linux, but should work basically the same on windows).  

1.) You need to configure your apache to do virtual hosts (have you done
this yet).
2.) Set up your workers.properties file (used and read by apache to
connect to tomcat using mod_jk) to have several workers.  Then set up
your instances of tomcat with different ports in their server.xml
configurations (different ports for the shutdown port and for the AJP13
port -- you won't need anything else).

Cheers,

Scott

On Wed, 2002-09-25 at 15:35, Matt Raible wrote:
> I'm trying to create different instances of Tomcat similar to what my
> ISP has.  I think they have an Apache front-end and each user gets their
> own instance of Tomcat and JVM.  I want to setup this same thing for a
> client I have - and I *hope* to make it run on OS X, Windows (2000/XP)
> and Linux (Red Hat 7.3).  Linux is their production platform.
> 
> I read this article (http://www.ubeans.com/tomcat/) which details how to
> do it with the AJP connector.  I think I read that the WARP connector is
> not supported on Windows - is this true?  What do you veterans
> recommend?  We've got a fresh server and our application works across
> all 4.x versions of Tomcat, so I'd like to use the latest stuff.
> 
> Some interesting stuff from the article:
> ----------------------------------------
> Question 1:
> Why did you choose to use the AJP13 connector rather than the WARP
> connector that is recommended? 
> 
> Answer:
> The warp connector is used in conjunction with mod_webapp, and
> mod_webapp does not currently support load balancing. 
> 
> Also, I found the documentation for the warp connector on the Jakarta
> web site to be quite lacking. See:
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/warp.html 
> 
> I know that the future lies in the warp connector, but in the meantime,
> I needed something. The documentation did not explain to me exactly what
> benefits I would get from using the Warp connector as opposed to AJP13. 
> 
> Question 2:
> You might specify that creating two instances of the tomcat installation
> is not needed as you can share the main binaries and libs by specifying
> 2 distinct CATALINA_BASE variables. 
> 
> True, but in real life the two tomcat servers are usually located on two
> different machines. My setup might be overkill for a single machine
> setup, but it's easy to tar up the "tomcat2" server and put it on a
> second machine; you just have to change "localhost" to the appropriate
> machine name in /usr/local/apache/conf/workers.properties and you're
> done. 
> 
> Question 3:
> What does not work and what does work in load balancing? 
> 
> Answer:
> Load balancing works great. 
> 
> 1. Session affinity works
> Which means that when a client browser is directed to a Tomcat server by
> the load balancer, then future queries from that same browser session
> will always be directed to the same tomcat server. This is important
> because sessions that are created in a specific tomcat server, say
> "tomcat1", do not exist in the other server "tomcat2", and thus if the
> client was directed to another tomcat server than the one where his
> session is stored, then all his session data would be lost. 
> 
> Some people are working on sessions that will be replicated across all
> tomcat servers in the cluster, so I'll just wait for it to become
> available rather than make a homebrewed distributed session mechanism. 
> 
> The downside of not having sessions replicated across all the tomcat
> servers in the cluster is that if one tomcat server dies, all the
> sessions that it contained are lost, which usually makes a lot of
> unhappy users. 
> 
> 2. Failover works
> If one tomcat server dies, the load balancer then "rebalances" the
> queries to the remaining tomcat servers. 
> 
> 3. Failback works
> When a tomcat server comes back from the dead, the load balancer
> automatically starts to send queries to it. So you can actually add
> capacity to your cluster on the fly. 
> 
> 4. Weighted load balancing works
> In /usr/local/apache/conf/workers.properties, I assigned a load
> balancing factor of 100 to both "tomcat1" and "tomcat2" servers. Then I
> changed the lbfactor of "tomcat1" to 101, and I saw that effectively the
> "tomcat1" server received more load than the "tomcat2" server, which is
> something you want when for example your "tomcat1" server is a
> faster/newer machine while your "tomcat2" server is a slower machine
> which cannnot take as much load as the other one. 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>