You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anil Ranka <an...@gmail.com> on 2006/09/28 15:50:15 UTC

Help with Tomcat Clustering and load balancing

Hi All,

  I am new with Tomcat Clustering feature. I have configured my three
tomcats nodes in cluster mode and they are talking to each other no issues.
Out these three nodes N1, N2 and N3 only one node will be ACTIVE node and
rest two will be PASSIVE. ACTIVE means my app will be loaded on only one
node. When this ACTIVE node goes down, using clustering mechanism I am able
to load my APP on next node from list. This scenario works very well. !!!!
NO ISSUES!!!

Now to out side world I have to give URL so that they can submit jobs to
this clustered nodes. Here I get lost. I am assuming I need load
balancer/proxy will which will route my request to ACTIVE node.

My question is : How to configure load balancer/proxy server to rote my
request to any specific ACTIVE node.

I tries tomcat web apps load balance, it does url redirect and I loose my
request data.

Any help/pointer will be highly appreciated.

Thanks
Anil S. Ranka

Re: Help with Tomcat Clustering and load balancing

Posted by Pascal Bleser <pa...@atosorigin.com>.
Anil Ranka wrote:
> Pascal,
>  Thanks for detail scenario. I am working on a product which should run on
> any platform. I am looking for a very generic solution which can run on any
> platform.
> 
> Any pointers.

Umm... stop dreaming ;)

As soon as you enter HA clustering and failover, there are hardly any
generic or platform agnostic solutions because it is typically bound
with the capabilities of the underlying operating system or to
specific software that handles it.

As an example, pen runs on several Un*x variants (Linux, *BSD, AIX,
Solaris, others) and there even seems to be a windows binary out there.

For more robust variants, such as the one I described with Linux and
heartbeat, you're not going to find any equivalent solution that is
"generic".

Using Apache2 and mod_jk is as generic as it gets.

> On 9/29/06, Pascal Bleser <pa...@atosorigin.com> wrote:
>>
>> Anil Ranka wrote:
>> >  I am new with Tomcat Clustering feature. I have configured my three
>> > tomcats nodes in cluster mode and they are talking to each other no
>> issues.
>> > Out these three nodes N1, N2 and N3 only one node will be ACTIVE node
>> and
>> > rest two will be PASSIVE. ACTIVE means my app will be loaded on only
>> one
>> > node. When this ACTIVE node goes down, using clustering mechanism I am
>> able
>> > to load my APP on next node from list. This scenario works very well.
>> !!!!
>> > NO ISSUES!!!
>>
>> I presume that means you are using session replication (probably in
>> "pooled" mode) across the Tomcat nodes.
>>
>> > Now to out side world I have to give URL so that they can submit
>> jobs to
>> > this clustered nodes. Here I get lost. I am assuming I need load
>> > balancer/proxy will which will route my request to ACTIVE node.
>>
>> You don't need a load balancer, as you have a hot standby scenario
>> and, hence, only one Tomcat node is active at a time.
>>
>> A load balancer is only needed when you want to use several Tomcat
>> nodes in parallel (hence, "active/active" scenario).
>>
>> > My question is : How to configure load balancer/proxy server to
>> route my
>> > request to any specific ACTIVE node.
>>
>> Well, you have a vast number of options especially if you consider a
>> more mature server platform (e.g. Linux), which offers a lot of
>> technical solutions to this problem.
>>
>> On Linux, I would say that one of the most robust solutions is to use
>> two Tomcat nodes with heartbeat [1] and a VIP (Virtual IP address).
>> With this approach, an IP address is configured as an IP alias on the
>> active node (that's the "VIP"). Just map your DNS name to that VIP
>> instead of the "real IPs" of the nodes.
>> With heartbeat, the Tomcat nodes will monitor each other and when the
>> active node fails to service (either dies completely, e.g. hardware
>> failure, taken down for maintainance, Tomcat crashes or just fails to
>> service a request in a specified amount of time (= load is too high)),
>> the other node will perform a takeover.
>> In this case, a takeover just means to move the VIP address to the
>> fallback node, which then becomes the active one (this works very
>> reliably, using RARP).
>> This is a very stable and tested architecture, works extremely well.
>> Once heartbeat is set up correctly on both nodes, it just runs and
>> runs. Rock solid from my experience (even with much more complex
>> scenarios such as combined with Linux Virtual Server, shared storage,
>> rinetd and mon).
>>
>> Another option is to put a director node in front of the Tomcat nodes.
>> There, again, a lot of different options can be used.
>> A very simple (and effective) one is to use "pen" [2]:
>>   pen -e 192.168.1.2:8080 80 192.168.1.1:8080
>> The example above will make pen listen on port 80 and redirect to
>> 192.168.1.1 on port 8080. When 192.168.1.1 is not reachable, it will
>> redirect to 192.168.1.2 instead (also on port 8080), called the
>> "emergency node" (-e).
>> For further details, consult the pen documentation at [2].
>>
>> To avoid having the director as a single point of failure (using
>> VRRP), read [3]
>>
>> The same can be done without having director nodes, see [4]
>>
>> Other options are Apache2 with mod_jk, LVS [5], haproxy [6], ...
>>
>> [1] heartbeat: http://linux-ha.org/
>> [2] pen: http://siag.nu/pen/
>> [3] http://siag.nu/pen/vrrpd-linux.shtml
>> [4] http://siag.nu/pen/vrrpd-linux2.shtml
>> [5] http://www.linuxvirtualserver.org/
>> [6] http://haproxy.1wt.eu/ and
>> http://haproxy.1wt.eu/download/1.2/doc/haproxy-en.txt

-- 
  -o) Pascal Bleser               ATOS Worldline/Aachen(DE)
  /\\   System Architect              WLP Business Platform
 _\_v "Really, I'm not out to destroy Microsoft.  That will
just be a completely unintentional side effect."-L.Torvalds


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


Re: Help with Tomcat Clustering and load balancing

Posted by Anil Ranka <an...@gmail.com>.
Pascal,
  Thanks for detail scenario. I am working on a product which should run on
any platform. I am looking for a very generic solution which can run on any
platform.

Any pointers.

Anil S. Ranka


On 9/29/06, Pascal Bleser <pa...@atosorigin.com> wrote:
>
> Anil Ranka wrote:
> >  I am new with Tomcat Clustering feature. I have configured my three
> > tomcats nodes in cluster mode and they are talking to each other no
> issues.
> > Out these three nodes N1, N2 and N3 only one node will be ACTIVE node
> and
> > rest two will be PASSIVE. ACTIVE means my app will be loaded on only one
> > node. When this ACTIVE node goes down, using clustering mechanism I am
> able
> > to load my APP on next node from list. This scenario works very well.
> !!!!
> > NO ISSUES!!!
>
> I presume that means you are using session replication (probably in
> "pooled" mode) across the Tomcat nodes.
>
> > Now to out side world I have to give URL so that they can submit jobs to
> > this clustered nodes. Here I get lost. I am assuming I need load
> > balancer/proxy will which will route my request to ACTIVE node.
>
> You don't need a load balancer, as you have a hot standby scenario
> and, hence, only one Tomcat node is active at a time.
>
> A load balancer is only needed when you want to use several Tomcat
> nodes in parallel (hence, "active/active" scenario).
>
> > My question is : How to configure load balancer/proxy server to route my
> > request to any specific ACTIVE node.
>
> Well, you have a vast number of options especially if you consider a
> more mature server platform (e.g. Linux), which offers a lot of
> technical solutions to this problem.
>
> On Linux, I would say that one of the most robust solutions is to use
> two Tomcat nodes with heartbeat [1] and a VIP (Virtual IP address).
> With this approach, an IP address is configured as an IP alias on the
> active node (that's the "VIP"). Just map your DNS name to that VIP
> instead of the "real IPs" of the nodes.
> With heartbeat, the Tomcat nodes will monitor each other and when the
> active node fails to service (either dies completely, e.g. hardware
> failure, taken down for maintainance, Tomcat crashes or just fails to
> service a request in a specified amount of time (= load is too high)),
> the other node will perform a takeover.
> In this case, a takeover just means to move the VIP address to the
> fallback node, which then becomes the active one (this works very
> reliably, using RARP).
> This is a very stable and tested architecture, works extremely well.
> Once heartbeat is set up correctly on both nodes, it just runs and
> runs. Rock solid from my experience (even with much more complex
> scenarios such as combined with Linux Virtual Server, shared storage,
> rinetd and mon).
>
> Another option is to put a director node in front of the Tomcat nodes.
> There, again, a lot of different options can be used.
> A very simple (and effective) one is to use "pen" [2]:
>   pen -e 192.168.1.2:8080 80 192.168.1.1:8080
> The example above will make pen listen on port 80 and redirect to
> 192.168.1.1 on port 8080. When 192.168.1.1 is not reachable, it will
> redirect to 192.168.1.2 instead (also on port 8080), called the
> "emergency node" (-e).
> For further details, consult the pen documentation at [2].
>
> To avoid having the director as a single point of failure (using
> VRRP), read [3]
>
> The same can be done without having director nodes, see [4]
>
> Other options are Apache2 with mod_jk, LVS [5], haproxy [6], ...
>
> [1] heartbeat: http://linux-ha.org/
> [2] pen: http://siag.nu/pen/
> [3] http://siag.nu/pen/vrrpd-linux.shtml
> [4] http://siag.nu/pen/vrrpd-linux2.shtml
> [5] http://www.linuxvirtualserver.org/
> [6] http://haproxy.1wt.eu/ and
> http://haproxy.1wt.eu/download/1.2/doc/haproxy-en.txt
>
> hope this helps
>
> --
>   -o) Pascal Bleser               ATOS Worldline/Aachen(DE)
>   /\\   System Architect              WLP Business Platform
> _\_v "Really, I'm not out to destroy Microsoft.  That will
> just be a completely unintentional side effect."-L.Torvalds
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Help with Tomcat Clustering and load balancing

Posted by Pascal Bleser <pa...@atosorigin.com>.
Anil Ranka wrote:
>  I am new with Tomcat Clustering feature. I have configured my three
> tomcats nodes in cluster mode and they are talking to each other no issues.
> Out these three nodes N1, N2 and N3 only one node will be ACTIVE node and
> rest two will be PASSIVE. ACTIVE means my app will be loaded on only one
> node. When this ACTIVE node goes down, using clustering mechanism I am able
> to load my APP on next node from list. This scenario works very well. !!!!
> NO ISSUES!!!

I presume that means you are using session replication (probably in
"pooled" mode) across the Tomcat nodes.

> Now to out side world I have to give URL so that they can submit jobs to
> this clustered nodes. Here I get lost. I am assuming I need load
> balancer/proxy will which will route my request to ACTIVE node.

You don't need a load balancer, as you have a hot standby scenario
and, hence, only one Tomcat node is active at a time.

A load balancer is only needed when you want to use several Tomcat
nodes in parallel (hence, "active/active" scenario).

> My question is : How to configure load balancer/proxy server to route my
> request to any specific ACTIVE node.

Well, you have a vast number of options especially if you consider a
more mature server platform (e.g. Linux), which offers a lot of
technical solutions to this problem.

On Linux, I would say that one of the most robust solutions is to use
two Tomcat nodes with heartbeat [1] and a VIP (Virtual IP address).
With this approach, an IP address is configured as an IP alias on the
active node (that's the "VIP"). Just map your DNS name to that VIP
instead of the "real IPs" of the nodes.
With heartbeat, the Tomcat nodes will monitor each other and when the
active node fails to service (either dies completely, e.g. hardware
failure, taken down for maintainance, Tomcat crashes or just fails to
service a request in a specified amount of time (= load is too high)),
the other node will perform a takeover.
In this case, a takeover just means to move the VIP address to the
fallback node, which then becomes the active one (this works very
reliably, using RARP).
This is a very stable and tested architecture, works extremely well.
Once heartbeat is set up correctly on both nodes, it just runs and
runs. Rock solid from my experience (even with much more complex
scenarios such as combined with Linux Virtual Server, shared storage,
rinetd and mon).

Another option is to put a director node in front of the Tomcat nodes.
There, again, a lot of different options can be used.
A very simple (and effective) one is to use "pen" [2]:
  pen -e 192.168.1.2:8080 80 192.168.1.1:8080
The example above will make pen listen on port 80 and redirect to
192.168.1.1 on port 8080. When 192.168.1.1 is not reachable, it will
redirect to 192.168.1.2 instead (also on port 8080), called the
"emergency node" (-e).
For further details, consult the pen documentation at [2].

To avoid having the director as a single point of failure (using
VRRP), read [3]

The same can be done without having director nodes, see [4]

Other options are Apache2 with mod_jk, LVS [5], haproxy [6], ...

[1] heartbeat: http://linux-ha.org/
[2] pen: http://siag.nu/pen/
[3] http://siag.nu/pen/vrrpd-linux.shtml
[4] http://siag.nu/pen/vrrpd-linux2.shtml
[5] http://www.linuxvirtualserver.org/
[6] http://haproxy.1wt.eu/ and
http://haproxy.1wt.eu/download/1.2/doc/haproxy-en.txt

hope this helps

-- 
  -o) Pascal Bleser               ATOS Worldline/Aachen(DE)
  /\\   System Architect              WLP Business Platform
 _\_v "Really, I'm not out to destroy Microsoft.  That will
just be a completely unintentional side effect."-L.Torvalds


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