Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Load balancing with Apache mod_proxy(how to setup correctly?)
Load balancing with Apache mod_proxy [message #543299] Tue, 29 June 2010 01:32 Go to next message
KK  is currently offline KK Friend
Messages: 4
Registered: June 2010
Junior Member
I am running a RAP app on Tomcat, fronting it with Apache. Currently, I want to scale it up so that there are 2 Tomcat servers running behind Apache load balancer. I followed some tutorials on the web and it seems that the sessions messed up (It keeps showing "The server session timed out. Please click here to restart the session.")

I found this presentation slides (http://www.java-forum-stuttgart.de/jfs/2007/folien/A4.pdf) on Google. It said that "load balancing possible with standard apache mod_jk / mod_proxy, but requires some work". So how can I set it up correctly? or I have simply made some silly mistakes? Embarrassed

Here is my current Apache load balancer settings:
<Proxy balancer://tomcatcuster/>
        BalancerMember ajp://server1:8009/ loadfactor=50 route=server1
        BalancerMember ajp://server2:8010/ loadfactor=50 route=server2
        ProxySet lbmethod=byrequests
</Proxy>

ProxyPass / balancer://tomcatcuster/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / ajp://server1:8009/
ProxyPassReverse / ajp://server2:8010/


Thx a lot.
Re: Load balancing with Apache mod_proxy [message #543461 is a reply to message #543299] Tue, 29 June 2010 13:54 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi,

Is the "lbmethod=byrequests" parameter by intention? Regarding the
documentation
( http://httpd.apache.org/docs/2.1/mod/mod_proxy_balancer.html) it does
exactly the opposite of sticky session. Maybe try to run the
configuration without the byrequests param.

Regards,
Ben

KK wrote:
> I am running a RAP app on Tomcat, fronting it with Apache. Currently, I
> want to scale it up so that there are 2 Tomcat servers running behind
> Apache load balancer. I followed some tutorials on the web and it seems
> that the sessions messed up (It keeps showing "The server session timed
> out. Please click here to restart the session.")
>
> I found this presentation slides
> (http://www.java-forum-stuttgart.de/jfs/2007/folien/A4.pdf) on Google.
> It said that "load balancing possible with standard apache mod_jk /
> mod_proxy, but requires some work". So how can I set it up correctly?
> or I have simply made some silly mistakes? :blush:
> Here is my current Apache load balancer settings:
>
> <Proxy balancer://tomcatcuster/>
> BalancerMember ajp://server1:8009/ loadfactor=50 route=server1
> BalancerMember ajp://server2:8010/ loadfactor=50 route=server2
> ProxySet lbmethod=byrequests
> </Proxy>
>
> ProxyPass / balancer://tomcatcuster/ stickysession=JSESSIONID|jsessionid
> nofailover=On
> ProxyPassReverse / ajp://server1:8009/
> ProxyPassReverse / ajp://server2:8010/
>
>
> Thx a lot.


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: Load balancing with Apache mod_proxy [message #546109 is a reply to message #543299] Sun, 11 July 2010 06:33 Go to previous messageGo to next message
KK  is currently offline KK Friend
Messages: 4
Registered: June 2010
Junior Member
Sorry for my late reply. I think we know what the problem is.

In our application, we turned coolies off so that multi-tabs browsing is supported. According to the RAP's FAQ, the application will append the session id into the url, rather than storing it in the cookies.

We have set the Apache load-balancer to direct the requests to the corresponding Tomcat server based on the session id in url. However, the application does not run correctly. After some investigation in the log file, we discovered that there are quite a lot 404 not found error, all of them are image/icon files. I am not sure if it is a problem of RAP.

Here is a RAP HTTP request for getting an icon:
GET rwt-resources/48.fwk1249086728/icons/icon.gif

The part "48.fwk1249086728" is dynamically generated, but the request URL does not contains the session id. So this request will be randomly dispatched by the load balancer even sticky session is set. This results a 404 error when the request is handled by a wrong server.

Due to this problem we have to enable cookies to make the load balancer works.
Re: Load balancing with Apache mod_proxy [message #546158 is a reply to message #546109] Sun, 11 July 2010 21:29 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,

about your problem with 404 error, there is already an opened bug for it:
317685: Images loaded from ext. points don't work behind session based
load balancers
https://bugs.eclipse.org/bugs/show_bug.cgi?id=317685

Best,
Ivan

On 07/11/2010 9:33 AM, KK wrote:
> Sorry for my late reply. I think we know what the problem is.
>
> In our application, we turned coolies off so that multi-tabs browsing
> is supported. According to the RAP's FAQ, the application will append
> the session id into the url, rather than storing it in the cookies.
>
> We have set the Apache load-balancer to direct the requests to the
> corresponding Tomcat server based on the session id in url. However,
> the application does not run correctly. After some investigation in
> the log file, we discovered that there are quite a lot 404 not found
> error, all of them are image/icon files. I am not sure if it is a
> problem of RAP.
>
> Here is a RAP HTTP request for getting an icon:
> GET rwt-resources/48.fwk1249086728/icons/icon.gif
>
> The part "48.fwk1249086728" is dynamically generated, but the request
> URL does not contains the session id. So this request will be randomly
> dispatched by the load balancer even sticky session is set. This
> results a 404 error when the request is handled by a wrong server.
>
> Due to this problem we have to enable cookies to make the load
> balancer works.
Previous Topic:Button size
Next Topic:Timing problems with BrowserFunctions
Goto Forum:
  


Current Time: Fri Apr 19 23:11:21 GMT 2024

Powered by FUDForum. Page generated in 0.04438 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top