You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by George Shafik <gs...@optusnet.com.au> on 2001/08/09 00:39:35 UTC
Redirection and Load Balancing
Hi All,
Current System Architecture
Apache : 3.17 (Custom Build)
Tomcat : 3.2.2 (Custom Build)
Deployment : war files.
Platform : Red Hat Linux 6.2
We are after a method to redirect based on a limit on the number of page
hits or the load on the current Web Server.
The redirection needs to be performed by Apache or Tomcat not by the web
page itself. Currently we are redirecting the user to another Web Server
from the current page as the page hits reach a certain limit or the load is
too much on the current box. A better way to conduct this is to redirect the
call to another Web Server at the Web Server or Servlet Engine level, in our
case that's Apache or Tomcat. Its not clear to us where in Apache or Tomcat
we can configure things based on page hits or load if its possible to do at
all.
Many thanks in advance for any help in this area.
Regards,
George Shafik
RE: Redirection and Load Balancing
Posted by Paul Nock <pn...@medicineplanet.com>.
>-----Original Message-----
>From: George Shafik [mailto:gshafik@optusnet.com.au]
>Sent: Thursday, August 09, 2001 5:28 PM
>To: tomcat-user@jakarta.apache.org
>Subject: Re: Redirection and Load Balancing
>>
>
>Magic Paul!
>
>Just a correction on the version of Apache we are running - 1.3.12 and
still
>trialing 1.3.19.
>
>
>> worker.worker1.host=localhost # never tried a remote machine, but
you
>Point of confusion
>Are you running your tomcats (JVMs) on separate servers ?
>If so how do you determine when "load balancing" kicks in and its
>effectiveness ?
>Or do you do what most of us do and wait for bitter complaints about
>performance ?
==========================================================================
==========================================================================
We have hardware loadbalancing in front of apache itself to split traffic
between boxes. Then when it gets to a server, each instance of tomcat is on
the same box. I haven't looked too much into the effectiveness of the
mod_jk loadbalancing. Our approach was more that:
1. front end loadbalancing to do a 'best-effort', 'good-enough' approach to
spread the load out.
2. a bigger factor in using the mod_jk loadbalancing was really to keep the
number of concurrent sessions per JVM down. What I observed was that in
general tomcat performance of our application was fairly plateau-like.
Performance was fairly consistent up to some break down point in number of
concurrent sessions. This point was usually reached long before the machine
itself was overloaded, when the number of Java threads running gets out of
control. Splitting n x 100 users across n x JVMs effectively improved the
capacity of the whole setup.
==========================================================================
==========================================================================
>> # duplicate these lines for every worker... (not lbworker)
>> worker.worker1.port=<number> # matching the port number from this
>>Our main gateway machine is a Linux box (sits behind our firewall) and we
>use port mapping to resolve respective URL calls to the appropriate Web
>Server. This is the only way we found in order to integrate IIS4/5 into our
>Web Site alongside tomcat. My main concern is how are you resolving the
URL
>calls to the appropriate server. Its clear you will have duplicate document
>structures on each of the JVMs but is this where things get resolved ?
==========================================================================
==========================================================================
I'm not sure I understand exactly. We have the same URLs on all servers in
the loadbalanced setup, so from that point of view it doesn't matter which
server the hardware loadbalancer routes a request to. Except that we need
sessions to be directed to the same server everytime. For this we tag
requests with a cookie so the loadbalancer sends subsequent requests to the
same place. Once the request is at the correct physical box where the
session is running, mod_jk takes care of passing it to the right JVM.
==========================================================================
==========================================================================
>George
>----- Original Message -----
>From: "Paul Nock" <pn...@medicineplanet.com>
>To: <to...@jakarta.apache.org>
>Sent: Friday, August 10, 2001 7:31 AM
>>Subject: RE: Redirection and Load Balancing
>
> We're running Linux, Tomcat 3.n (currently 3.2.2), and Apache 1.3.19 (and
> also 1.3.12).
>
> We did rebuild binaries, but didn't really need to. The only weird thing
we
> did was so the hardware load balancer in front of our servers kept cookie
> and/or jsessionid sessions on the same physical hardware so mod_jk
> loadbalancing could do its thing.
>
> Tomcat:
> server*.xml: one for each tomcat JVM, then in your startup script do
> something like:
> java -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat -f
> ${TOMCAT_HOME}/conf/server1.xml "$@"
> so you can run everythint out of the same tomcat home.
>
> workers.properties:
> worker.list=lbworker, worker1, worker2,...
>
> # duplicate these lines for every worker... (not lbworker)
> worker.worker1.port=<number> # matching the port number from this
> instances server*.xml file
> worker.worker1.host=localhost # never tried a remote machine, but you
> could
> worker.worker1.type=ajp13 # or ajp12 if you're using it
> worker.worker1.lbfactor=2 # we don't use this
> worker.w1a.cachesize=1 # or this
>
> worker.lbworker.type=lb
> worker.lbworker.balanced_workers=worker1, worker2,...
>
> ModJk.conf: use the auto-generated file as a template and mount the
contexts
> you want to balance on the lb worker...
> JkMount /servlet/* lbworker
>
> Apache: append the ModJk.conf file to httpd.conf
>
> Paul
>
> -----Original Message-----
> From: George Shafik [mailto:gshafik@optusnet.com.au]
> Sent: Wednesday, August 08, 2001 5:10 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: Redirection and Load Balancing
>
>
>
> Sounds great Paul.
>
> What sort of environment are you using mod_jk in ?
> - OS platform
> - Version of Apache, Tomcat
> - How many versions of Apache and Tomcat are you running in parallel in
> order to mirror your Web Site so you can perform your load balancing.
> - Are all your binaries custom built ?
>
> Can you please e-mail me directly all relevant Apache/Tomcat configuration
> files that I need to alter in order to use mod_jk in the manner you
> describe. If this is too difficult cut and past the relevant pieces
> commenting on where they are from into one file.
>
> Regards,
> George Shafik
> gshafik@gsss.net
>
>
> ----- Original Message -----
> From: "Paul Nock" <pn...@medicineplanet.com>
> To: <to...@jakarta.apache.org>
> Sent: Thursday, August 09, 2001 8:44 AM
> Subject: RE: Redirection and Load Balancing
>
>
> > You can use mod_jk to load balance between different JVMs running
Tomcat.
> > Works well, we use it.
> >
> > The JVMs could then also be on remote machines to either each other,
> and/or
> > the machine running Apache.
> >
> > mod_jk will preserve sessions for you so that subsequent request go to
the
> > right JVM.
> >
> > You'll need to configure the workers.properties, etc. to use the
> > 'loadbalancer' worker.
> >
> > Paul
> >
> > -----Original Message-----
> > From: George Shafik [mailto:gshafik@optusnet.com.au]
> > Sent: Wednesday, August 08, 2001 3:40 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Redirection and Load Balancing
> >
> >
> > Hi All,
> >
> > Current System Architecture
> > Apache : 3.17 (Custom Build)
> > Tomcat : 3.2.2 (Custom Build)
> > Deployment : war files.
> > Platform : Red Hat Linux 6.2
> >
> > We are after a method to redirect based on a limit on the number of page
> > hits or the load on the current Web Server.
> >
> > The redirection needs to be performed by Apache or Tomcat not by the web
> > page itself. Currently we are redirecting the user to another Web Server
> > from the current page as the page hits reach a certain limit or the load
> is
> > too much on the current box. A better way to conduct this is to redirect
> the
> > call to another Web Server at the Web Server or Servlet Engine level, in
> our
> > case that's Apache or Tomcat. Its not clear to us where in Apache or
> Tomcat
> > we can configure things based on page hits or load if its possible to do
> at
> > all.
> >
> > Many thanks in advance for any help in this area.
> >
> > Regards,
> > George Shafik
> >
> >
> >
> >
>
>
Re: Redirection and Load Balancing
Posted by George Shafik <gs...@optusnet.com.au>.
Magic Paul!
Just a correction on the version of Apache we are running - 1.3.12 and still
trialing 1.3.19.
> worker.worker1.host=localhost # never tried a remote machine, but you
Point of confusion
Are you running your tomcats (JVMs) on separate servers ?
If so how do you determine when "load balancing" kicks in and its
effectiveness ?
Or do you do what most of us do and wait for bitter complaints about
performance ?
> # duplicate these lines for every worker... (not lbworker)
> worker.worker1.port=<number> # matching the port number from this
Our main gateway machine is a Linux box (sits behind our firewall) and we
use port mapping to resolve respective URL calls to the appropriate Web
Server. This is the only way we found in order to integrate IIS4/5 into our
Web Site alongside tomcat. My main concern is how are you resolving the URL
calls to the appropriate server. Its clear you will have duplicate document
structures on each of the JVMs but is this where things get resolved ?
George
----- Original Message -----
From: "Paul Nock" <pn...@medicineplanet.com>
To: <to...@jakarta.apache.org>
Sent: Friday, August 10, 2001 7:31 AM
Subject: RE: Redirection and Load Balancing
> We're running Linux, Tomcat 3.n (currently 3.2.2), and Apache 1.3.19 (and
> also 1.3.12).
>
> We did rebuild binaries, but didn't really need to. The only weird thing
we
> did was so the hardware load balancer in front of our servers kept cookie
> and/or jsessionid sessions on the same physical hardware so mod_jk
> loadbalancing could do its thing.
>
> Tomcat:
> server*.xml: one for each tomcat JVM, then in your startup script do
> something like:
> java -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat -f
> ${TOMCAT_HOME}/conf/server1.xml "$@"
> so you can run everythint out of the same tomcat home.
>
> workers.properties:
> worker.list=lbworker, worker1, worker2,...
>
> # duplicate these lines for every worker... (not lbworker)
> worker.worker1.port=<number> # matching the port number from this
> instances server*.xml file
> worker.worker1.host=localhost # never tried a remote machine, but you
> could
> worker.worker1.type=ajp13 # or ajp12 if you're using it
> worker.worker1.lbfactor=2 # we don't use this
> worker.w1a.cachesize=1 # or this
>
> worker.lbworker.type=lb
> worker.lbworker.balanced_workers=worker1, worker2,...
>
> ModJk.conf: use the auto-generated file as a template and mount the
contexts
> you want to balance on the lb worker...
> JkMount /servlet/* lbworker
>
> Apache: append the ModJk.conf file to httpd.conf
>
> Paul
>
> -----Original Message-----
> From: George Shafik [mailto:gshafik@optusnet.com.au]
> Sent: Wednesday, August 08, 2001 5:10 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: Redirection and Load Balancing
>
>
>
> Sounds great Paul.
>
> What sort of environment are you using mod_jk in ?
> - OS platform
> - Version of Apache, Tomcat
> - How many versions of Apache and Tomcat are you running in parallel in
> order to mirror your Web Site so you can perform your load balancing.
> - Are all your binaries custom built ?
>
> Can you please e-mail me directly all relevant Apache/Tomcat configuration
> files that I need to alter in order to use mod_jk in the manner you
> describe. If this is too difficult cut and past the relevant pieces
> commenting on where they are from into one file.
>
> Regards,
> George Shafik
> gshafik@gsss.net
>
>
> ----- Original Message -----
> From: "Paul Nock" <pn...@medicineplanet.com>
> To: <to...@jakarta.apache.org>
> Sent: Thursday, August 09, 2001 8:44 AM
> Subject: RE: Redirection and Load Balancing
>
>
> > You can use mod_jk to load balance between different JVMs running
Tomcat.
> > Works well, we use it.
> >
> > The JVMs could then also be on remote machines to either each other,
> and/or
> > the machine running Apache.
> >
> > mod_jk will preserve sessions for you so that subsequent request go to
the
> > right JVM.
> >
> > You'll need to configure the workers.properties, etc. to use the
> > 'loadbalancer' worker.
> >
> > Paul
> >
> > -----Original Message-----
> > From: George Shafik [mailto:gshafik@optusnet.com.au]
> > Sent: Wednesday, August 08, 2001 3:40 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Redirection and Load Balancing
> >
> >
> > Hi All,
> >
> > Current System Architecture
> > Apache : 3.17 (Custom Build)
> > Tomcat : 3.2.2 (Custom Build)
> > Deployment : war files.
> > Platform : Red Hat Linux 6.2
> >
> > We are after a method to redirect based on a limit on the number of page
> > hits or the load on the current Web Server.
> >
> > The redirection needs to be performed by Apache or Tomcat not by the web
> > page itself. Currently we are redirecting the user to another Web Server
> > from the current page as the page hits reach a certain limit or the load
> is
> > too much on the current box. A better way to conduct this is to redirect
> the
> > call to another Web Server at the Web Server or Servlet Engine level, in
> our
> > case that's Apache or Tomcat. Its not clear to us where in Apache or
> Tomcat
> > we can configure things based on page hits or load if its possible to do
> at
> > all.
> >
> > Many thanks in advance for any help in this area.
> >
> > Regards,
> > George Shafik
> >
> >
> >
> >
>
>
RE: Redirection and Load Balancing
Posted by Paul Nock <pn...@medicineplanet.com>.
We're running Linux, Tomcat 3.n (currently 3.2.2), and Apache 1.3.19 (and
also 1.3.12).
We did rebuild binaries, but didn't really need to. The only weird thing we
did was so the hardware load balancer in front of our servers kept cookie
and/or jsessionid sessions on the same physical hardware so mod_jk
loadbalancing could do its thing.
Tomcat:
server*.xml: one for each tomcat JVM, then in your startup script do
something like:
java -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat -f
${TOMCAT_HOME}/conf/server1.xml "$@"
so you can run everythint out of the same tomcat home.
workers.properties:
worker.list=lbworker, worker1, worker2,...
# duplicate these lines for every worker... (not lbworker)
worker.worker1.port=<number> # matching the port number from this
instances server*.xml file
worker.worker1.host=localhost # never tried a remote machine, but you
could
worker.worker1.type=ajp13 # or ajp12 if you're using it
worker.worker1.lbfactor=2 # we don't use this
worker.w1a.cachesize=1 # or this
worker.lbworker.type=lb
worker.lbworker.balanced_workers=worker1, worker2,...
ModJk.conf: use the auto-generated file as a template and mount the contexts
you want to balance on the lb worker...
JkMount /servlet/* lbworker
Apache: append the ModJk.conf file to httpd.conf
Paul
-----Original Message-----
From: George Shafik [mailto:gshafik@optusnet.com.au]
Sent: Wednesday, August 08, 2001 5:10 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: Redirection and Load Balancing
Sounds great Paul.
What sort of environment are you using mod_jk in ?
- OS platform
- Version of Apache, Tomcat
- How many versions of Apache and Tomcat are you running in parallel in
order to mirror your Web Site so you can perform your load balancing.
- Are all your binaries custom built ?
Can you please e-mail me directly all relevant Apache/Tomcat configuration
files that I need to alter in order to use mod_jk in the manner you
describe. If this is too difficult cut and past the relevant pieces
commenting on where they are from into one file.
Regards,
George Shafik
gshafik@gsss.net
----- Original Message -----
From: "Paul Nock" <pn...@medicineplanet.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, August 09, 2001 8:44 AM
Subject: RE: Redirection and Load Balancing
> You can use mod_jk to load balance between different JVMs running Tomcat.
> Works well, we use it.
>
> The JVMs could then also be on remote machines to either each other,
and/or
> the machine running Apache.
>
> mod_jk will preserve sessions for you so that subsequent request go to the
> right JVM.
>
> You'll need to configure the workers.properties, etc. to use the
> 'loadbalancer' worker.
>
> Paul
>
> -----Original Message-----
> From: George Shafik [mailto:gshafik@optusnet.com.au]
> Sent: Wednesday, August 08, 2001 3:40 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Redirection and Load Balancing
>
>
> Hi All,
>
> Current System Architecture
> Apache : 3.17 (Custom Build)
> Tomcat : 3.2.2 (Custom Build)
> Deployment : war files.
> Platform : Red Hat Linux 6.2
>
> We are after a method to redirect based on a limit on the number of page
> hits or the load on the current Web Server.
>
> The redirection needs to be performed by Apache or Tomcat not by the web
> page itself. Currently we are redirecting the user to another Web Server
> from the current page as the page hits reach a certain limit or the load
is
> too much on the current box. A better way to conduct this is to redirect
the
> call to another Web Server at the Web Server or Servlet Engine level, in
our
> case that's Apache or Tomcat. Its not clear to us where in Apache or
Tomcat
> we can configure things based on page hits or load if its possible to do
at
> all.
>
> Many thanks in advance for any help in this area.
>
> Regards,
> George Shafik
>
>
>
>
Re: Redirection and Load Balancing
Posted by George Shafik <gs...@optusnet.com.au>.
Sounds great Paul.
What sort of environment are you using mod_jk in ?
- OS platform
- Version of Apache, Tomcat
- How many versions of Apache and Tomcat are you running in parallel in
order to mirror your Web Site so you can perform your load balancing.
- Are all your binaries custom built ?
Can you please e-mail me directly all relevant Apache/Tomcat configuration
files that I need to alter in order to use mod_jk in the manner you
describe. If this is too difficult cut and past the relevant pieces
commenting on where they are from into one file.
Regards,
George Shafik
gshafik@gsss.net
----- Original Message -----
From: "Paul Nock" <pn...@medicineplanet.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, August 09, 2001 8:44 AM
Subject: RE: Redirection and Load Balancing
> You can use mod_jk to load balance between different JVMs running Tomcat.
> Works well, we use it.
>
> The JVMs could then also be on remote machines to either each other,
and/or
> the machine running Apache.
>
> mod_jk will preserve sessions for you so that subsequent request go to the
> right JVM.
>
> You'll need to configure the workers.properties, etc. to use the
> 'loadbalancer' worker.
>
> Paul
>
> -----Original Message-----
> From: George Shafik [mailto:gshafik@optusnet.com.au]
> Sent: Wednesday, August 08, 2001 3:40 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Redirection and Load Balancing
>
>
> Hi All,
>
> Current System Architecture
> Apache : 3.17 (Custom Build)
> Tomcat : 3.2.2 (Custom Build)
> Deployment : war files.
> Platform : Red Hat Linux 6.2
>
> We are after a method to redirect based on a limit on the number of page
> hits or the load on the current Web Server.
>
> The redirection needs to be performed by Apache or Tomcat not by the web
> page itself. Currently we are redirecting the user to another Web Server
> from the current page as the page hits reach a certain limit or the load
is
> too much on the current box. A better way to conduct this is to redirect
the
> call to another Web Server at the Web Server or Servlet Engine level, in
our
> case that's Apache or Tomcat. Its not clear to us where in Apache or
Tomcat
> we can configure things based on page hits or load if its possible to do
at
> all.
>
> Many thanks in advance for any help in this area.
>
> Regards,
> George Shafik
>
>
>
>
RE: Redirection and Load Balancing
Posted by Paul Nock <pn...@medicineplanet.com>.
You can use mod_jk to load balance between different JVMs running Tomcat.
Works well, we use it.
The JVMs could then also be on remote machines to either each other, and/or
the machine running Apache.
mod_jk will preserve sessions for you so that subsequent request go to the
right JVM.
You'll need to configure the workers.properties, etc. to use the
'loadbalancer' worker.
Paul
-----Original Message-----
From: George Shafik [mailto:gshafik@optusnet.com.au]
Sent: Wednesday, August 08, 2001 3:40 PM
To: tomcat-user@jakarta.apache.org
Subject: Redirection and Load Balancing
Hi All,
Current System Architecture
Apache : 3.17 (Custom Build)
Tomcat : 3.2.2 (Custom Build)
Deployment : war files.
Platform : Red Hat Linux 6.2
We are after a method to redirect based on a limit on the number of page
hits or the load on the current Web Server.
The redirection needs to be performed by Apache or Tomcat not by the web
page itself. Currently we are redirecting the user to another Web Server
from the current page as the page hits reach a certain limit or the load is
too much on the current box. A better way to conduct this is to redirect the
call to another Web Server at the Web Server or Servlet Engine level, in our
case that's Apache or Tomcat. Its not clear to us where in Apache or Tomcat
we can configure things based on page hits or load if its possible to do at
all.
Many thanks in advance for any help in this area.
Regards,
George Shafik