You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Harsimranjit singh Kler <si...@gmail.com> on 2010/12/27 05:11:21 UTC

Re: Tomcat(5.5) Clustering and Load Balancing.

Hi

i have testing tomcat clustering on single machine.What i am able to do is i
hv 4 tomcat instances 1 work as balancer and 3 as cluster.using Rule.xml in
balancer with round robin approach.all requests hits on balancer redirected
to on one cluster which is on some different port.
when redirecting using sendredirect it display new url that is of cluster.i
want some alternate so all request shoud handled at balancer and URL at
adress bar not changed.

i have tried forward from servelet but that is not accept only realtive URL.

regards
HArry

Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by Mark Thomas <ma...@apache.org>.
On 04/01/2011 06:47, Harsimranjit singh Kler wrote:
> So this means tomcat alone have not sufficent support for Load Balancing and
> clustering?.

Correct. Tomcat does not provide a reverse proxy implementation.

> You main only way to achive is to use apache server HTTPD and connector,
> mod_jk things ?.

You can use any reverse proxy you like. httpd + mod_jk is just one option.

Mark

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


Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by Harsimranjit singh Kler <si...@gmail.com>.
So this means tomcat alone have not sufficent support for Load Balancing and
clustering?.
but i am able to check successfully: 1)Session maintaince2)Auto Deployment

Only thing i am not able to achive to hide Cluster URL on redirection.

You main only way to achive is to use apache server HTTPD and connector,
mod_jk things ?.



On Mon, Jan 3, 2011 at 7:44 PM, Pid <pi...@pidster.com> wrote:

> On 1/3/11 9:40 AM, Harsimranjit singh Kler wrote:
> > using tomcat instances only(balancer Feature)
>
> Why?
>
>
> http://tomcat.apache.org/tomcat-5.5-doc/balancer-howto.html#Using_the_balancer_webapp
>
> "This is a simple implementation of a rules-based load balancer. It was
> not designed as a replacement for other load-balancing mechanisms used
> for high traffic environments."
>
> IMHO I'd suggest that it's not suitable for most environments.
>
> Just use HTTPD and mod_jk.
>
>
> p
>



-- 

Regards

Harsimranjit Singh Kler

Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by Pid <pi...@pidster.com>.
On 1/3/11 9:40 AM, Harsimranjit singh Kler wrote:
> using tomcat instances only(balancer Feature) 

Why?

http://tomcat.apache.org/tomcat-5.5-doc/balancer-howto.html#Using_the_balancer_webapp

"This is a simple implementation of a rules-based load balancer. It was
not designed as a replacement for other load-balancing mechanisms used
for high traffic environments."

IMHO I'd suggest that it's not suitable for most environments.

Just use HTTPD and mod_jk.


p

Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by André Warnier <aw...@ice-sa.com>.
Harsimranjit singh Kler wrote:
> Hi
> 
> Here is details:
> 
> *Tomcat version*: 5.5.27
> *OS*:Window XP
> *JDK*:1.6
> *Environment Trying to Create* :Load balancing and Clustering on single
> Machine using tomcat instances only(balancer Feature) .
> 
> *What i have Achieved*:i am running 4 instances of tomcat on ports
> 8080,9080,10080,11080.So port 8080 tomcat work as balancer and other works
> as cluster.(Using Multicasting IP and Port {check server.xml} it works
> fine).
> attached find server.xml,web.xml,rule.xml of balancer tomcat(8080).
> 
> So using  balancer feature in tomcat and rule.xml and some customized
> classes requests are successfully redirected to one of cluster ie 9080,10080
> or 11080 instance.
> 
> *Issue*:when request redirected from tomcat balancer(on 8080 port) to any
> cluster (tomcat instance on 9080,10080 or 11080 port) URL in address bar
> also changed. i dont want to display cluster URL.So how i can achive this?.
> 
> i think "org.apache.webapp.balancer.BalancerFilter"  class internally use
> SendRedirect() method .
> 
> I tried with requestDispatcher..Forward() but it accept only realtive
> address.
> 
> 

I believe that David already gave you the basic answer.

>>>
>>>
>> From what I read in the message, it appears the balancer is sending the
>> browser a redirect (one of the 30x responses) which in turn changes the
>> url in the browser's address bar.  The OP (if I understand correctly)
>> would like the url in the browser's address bar not to change at all (no
>> 30x redirect response).  The only way I can imagine that working is if
>> the balancer acts as a reverse proxy, sending each request back to a
>> different back-end worker.

I don't think that what you want to achieve can be done (yet) with Tomcat alone.

As a bit of an outsider's answer, I'll add this : from browsing the Tomcat cluster on-line 
documentation, it looks to me as a very impresive piece of work, but also as quite a 
complex setup.

If your main purpose is to balance the load between a number of back-end Tomcat engines, I 
believe that using an Apache httpd front-end with either of the mod_proxy_ajp or the 
mod_jk connector, would be much easier to set up, and would provide exactly what you want 
: a single hostname:port for the clients, and load-balancing, and fail-over capabilities.

It does that, because it would act like David indicates above, as a "reverse proxy".  In 
this kind of configuration, the clients (browsers e.g.) always talk to the same front-end 
server, and receive the responses from that front-end server.  The front-end server in 
turn passes the requests to one of several back-end servers, and gets the response from 
them, which they then send back to the client.
The clients always talk to the front-end server, and see only that one; they never even 
know that there are back-end servers, and never see the hostname:port of these back-end 
servers.

Maybe the Tomcat cluster configuration does additional things which the front-end balancer 
setup cannot do.  But that is an area that I really don't know, and maybe someone else can 
comment on that.


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


Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by Harsimranjit singh Kler <si...@gmail.com>.
Hi

Here is details:

*Tomcat version*: 5.5.27
*OS*:Window XP
*JDK*:1.6
*Environment Trying to Create* :Load balancing and Clustering on single
Machine using tomcat instances only(balancer Feature) .

*What i have Achieved*:i am running 4 instances of tomcat on ports
8080,9080,10080,11080.So port 8080 tomcat work as balancer and other works
as cluster.(Using Multicasting IP and Port {check server.xml} it works
fine).
attached find server.xml,web.xml,rule.xml of balancer tomcat(8080).

So using  balancer feature in tomcat and rule.xml and some customized
classes requests are successfully redirected to one of cluster ie 9080,10080
or 11080 instance.

*Issue*:when request redirected from tomcat balancer(on 8080 port) to any
cluster (tomcat instance on 9080,10080 or 11080 port) URL in address bar
also changed. i dont want to display cluster URL.So how i can achive this?.

i think "org.apache.webapp.balancer.BalancerFilter"  class internally use
SendRedirect() method .

I tried with requestDispatcher..Forward() but it accept only realtive
address.


so please suggest me

Thanks in advance

Regards
Harsimran





On Tue, Dec 28, 2010 at 9:23 PM, David Smith <da...@cornell.edu>wrote:

>  On 12/28/2010 8:33 AM, Pid wrote:
> > On 12/27/10 4:11 AM, Harsimranjit singh Kler wrote:
> >> Hi
> >>
> >> i have testing tomcat clustering on single machine.What i am able to do
> is i
> >> hv 4 tomcat instances 1 work as balancer and 3 as cluster.using Rule.xml
> in
> >> balancer with round robin approach.all requests hits on balancer
> redirected
> >> to on one cluster which is on some different port.
> >> when redirecting using sendredirect it display new url that is of
> cluster.i
> >> want some alternate so all request shoud handled at balancer and URL at
> >> adress bar not changed.
> >>
> >> i have tried forward from servelet but that is not accept only realtive
> URL.
> > I'm sorry, I don't have any idea what you're actually asking.
> >
> > Please read:
> >
> >  http://www.catb.org/~esr/faqs/smart-questions.html
> >
> > When you reply, please precisely detail your Tomcat, JVM and OS
> > versions, also include an accurate description of the environment you
> > have created and are trying to create.
> >
> >
> >
> From what I read in the message, it appears the balancer is sending the
> browser a redirect (one of the 30x responses) which in turn changes the
> url in the browser's address bar.  The OP (if I understand correctly)
> would like the url in the browser's address bar not to change at all (no
> 30x redirect response).  The only way I can imagine that working is if
> the balancer acts as a reverse proxy, sending each request back to a
> different back-end worker.  I think we need to see the balancer's config
> before we could even begin to offer suggestions.
>
> --David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 

Regards

Harsimranjit Singh Kler

Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by David Smith <da...@cornell.edu>.
On 12/28/2010 8:33 AM, Pid wrote:
> On 12/27/10 4:11 AM, Harsimranjit singh Kler wrote:
>> Hi
>>
>> i have testing tomcat clustering on single machine.What i am able to do is i
>> hv 4 tomcat instances 1 work as balancer and 3 as cluster.using Rule.xml in
>> balancer with round robin approach.all requests hits on balancer redirected
>> to on one cluster which is on some different port.
>> when redirecting using sendredirect it display new url that is of cluster.i
>> want some alternate so all request shoud handled at balancer and URL at
>> adress bar not changed.
>>
>> i have tried forward from servelet but that is not accept only realtive URL.
> I'm sorry, I don't have any idea what you're actually asking.
>
> Please read:
>
>  http://www.catb.org/~esr/faqs/smart-questions.html
>
> When you reply, please precisely detail your Tomcat, JVM and OS
> versions, also include an accurate description of the environment you
> have created and are trying to create.
>
>
>
>From what I read in the message, it appears the balancer is sending the
browser a redirect (one of the 30x responses) which in turn changes the
url in the browser's address bar.  The OP (if I understand correctly)
would like the url in the browser's address bar not to change at all (no
30x redirect response).  The only way I can imagine that working is if
the balancer acts as a reverse proxy, sending each request back to a
different back-end worker.  I think we need to see the balancer's config
before we could even begin to offer suggestions.

--David

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


Re: Tomcat(5.5) Clustering and Load Balancing.

Posted by Pid <pi...@pidster.com>.
On 12/27/10 4:11 AM, Harsimranjit singh Kler wrote:
> Hi
> 
> i have testing tomcat clustering on single machine.What i am able to do is i
> hv 4 tomcat instances 1 work as balancer and 3 as cluster.using Rule.xml in
> balancer with round robin approach.all requests hits on balancer redirected
> to on one cluster which is on some different port.
> when redirecting using sendredirect it display new url that is of cluster.i
> want some alternate so all request shoud handled at balancer and URL at
> adress bar not changed.
> 
> i have tried forward from servelet but that is not accept only realtive URL.

I'm sorry, I don't have any idea what you're actually asking.

Please read:

 http://www.catb.org/~esr/faqs/smart-questions.html

When you reply, please precisely detail your Tomcat, JVM and OS
versions, also include an accurate description of the environment you
have created and are trying to create.


p