You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tamer Embaby <Ta...@itworx.com> on 2008/03/12 19:48:08 UTC

[users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA WL 8.1

Hello all,

I have the below configuration on my Apache 2.2.8 test server,
my 2 backends are BEA WebLogic 8.1 servers, basically I'm testing
if I can achieve the same load balancing feature that third party
BEA WL 8.1 weblogic_module is doing.

I open a browser window and wnet to: http://myserver/ and keep on
reloading the page and each time Apache is redirecting me to difference
backend, another example when I try to follow a link on a page that was
served from backend1, it direct me to backend2 which immediately returns
404 since it doesn't have the requested resource (each backend is
serving different application for testing purposes).

It seems that Apache is performing round-robin all the way and
discarding JSESSIONID cookie variable.

Is what I'm trying to do supported by load balancer module in Apache
2.2, can I have Apache 2.2 to stick session of BEA WL 8.1, am I missing
any configuration?

cluster.conf:
<VirtualHost *:80>
        ServerName myserver

        <Proxy balancer://itcluster>
                BalancerMember http://backend1:7070 route=be1
                BalancerMember http://backend2:7020 route=be2
        </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager
        </Location>

        ProxyPass /balancer-manager !
        ProxyPass / balancer://itcluster/ stickysession=JSESSIONID|jsessionid nofailover=On
        ProxyPassReverse / http://172.22.10.12:7045/
        ProxyPassReverse / http://172.22.10.10:7020/
 </VirtualHost>

Regards,
Tamer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA WL 8.1

Posted by Tamer Embaby <Ta...@itworx.com>.
Narendra,

OK, I got the idea behind it sticking a session in Apache 2.2.

I thought Apache 2.2 loadbalancer would intercept JESESSIONID (or
whatever Cookie variable I set in "stickysession" attribute) and
build a lookup table to back-ends that previously responded with
Set-Cookie header and stick sessions accordingly.  But I read a document
over the Internet and I read the code mod_proxy_balancer.c and it just
look for the "." in the value of the "stickysession" variable and match
it against the balancer member with the same "route" value, and just
route the request to that server.

So I solved my problem by completely ignoring JSESSIONID and built
my own session variable as follows:

(This is only proof of concept and not the real world example)

Apache backend 1 (front end to WebLogic 1 backend) in (httpd.conf):
Header set Cookie "SERVERID=Server.be1"

Apache backend 2 (front end to WebLogic 2 backend) in (httpd.conf):
Header set Cookie "SERVERID=Server.be2"

cluster.conf:
<VirtualHost *:80>
        ServerName myserver

        <Proxy balancer://itcluster>
                BalancerMember http://backend1:7070 route=be1
                BalancerMember http://backend2:7020 route=be2
        </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager
        </Location>

        ProxyPass /balancer-manager !
        ProxyPass / balancer://itcluster/
stickysession=SERVERID nofailover=On
        ProxyPassReverse / http://backend1:7070/
        ProxyPassReverse / http://backend2:7020/
 </VirtualHost>

And Apache 2.2 happily got the session stuck to backend1 whenever it
sees "Cookie: SERVERID=Server.be1" and to backend2 whenever it sees
"Cookie: SERVERID=Server.be2"

Hope this helps.

Regards,
Tamer

-----Original Message-----
From: Narendra Verma [mailto:narendra.verma@impetus.co.in]
Sent: Thursday, March 13, 2008 7:58 AM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA WL 8.1

Hi,
I had the same problem in my environment. But I was using tomcat instead of
web logic.
What is your JSESSIONID value?

It may be like:
  1. <integervalue>  for example 423423434134
  2. <itegervalue>.<word>  for example 423423434134.weblogic1

Can you please confirm me from logs which option as above r u getting from
Cookies JSESSIONID value?



-----Original Message-----
From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Thursday, March 13, 2008 12:18 AM
To: users@httpd.apache.org
Subject: [users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA
WL 8.1

Hello all,

I have the below configuration on my Apache 2.2.8 test server,
my 2 backends are BEA WebLogic 8.1 servers, basically I'm testing
if I can achieve the same load balancing feature that third party
BEA WL 8.1 weblogic_module is doing.

I open a browser window and wnet to: http://myserver/ and keep on
reloading the page and each time Apache is redirecting me to difference
backend, another example when I try to follow a link on a page that was
served from backend1, it direct me to backend2 which immediately returns
404 since it doesn't have the requested resource (each backend is
serving different application for testing purposes).

It seems that Apache is performing round-robin all the way and
discarding JSESSIONID cookie variable.

Is what I'm trying to do supported by load balancer module in Apache
2.2, can I have Apache 2.2 to stick session of BEA WL 8.1, am I missing
any configuration?

cluster.conf:
<VirtualHost *:80>
        ServerName myserver

        <Proxy balancer://itcluster>
                BalancerMember http://backend1:7070 route=be1
                BalancerMember http://backend2:7020 route=be2
        </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager
        </Location>

        ProxyPass /balancer-manager !
        ProxyPass / balancer://itcluster/
stickysession=JSESSIONID|jsessionid nofailover=On
        ProxyPassReverse / http://172.22.10.12:7045/
        ProxyPassReverse / http://172.22.10.10:7020/
 </VirtualHost>

Regards,
Tamer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA WL 8.1

Posted by Narendra Verma <na...@impetus.co.in>.
Hi,
I had the same problem in my environment. But I was using tomcat instead of
web logic.
What is your JSESSIONID value?

It may be like:  
  1. <integervalue>  for example 423423434134
  2. <itegervalue>.<word>  for example 423423434134.weblogic1

Can you please confirm me from logs which option as above r u getting from
Cookies JSESSIONID value?



-----Original Message-----
From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com] 
Sent: Thursday, March 13, 2008 12:18 AM
To: users@httpd.apache.org
Subject: [users@httpd] Apache 2.2 Loadbalancing/session stickiness for BEA
WL 8.1

Hello all,

I have the below configuration on my Apache 2.2.8 test server,
my 2 backends are BEA WebLogic 8.1 servers, basically I'm testing
if I can achieve the same load balancing feature that third party
BEA WL 8.1 weblogic_module is doing.

I open a browser window and wnet to: http://myserver/ and keep on
reloading the page and each time Apache is redirecting me to difference
backend, another example when I try to follow a link on a page that was
served from backend1, it direct me to backend2 which immediately returns
404 since it doesn't have the requested resource (each backend is
serving different application for testing purposes).

It seems that Apache is performing round-robin all the way and
discarding JSESSIONID cookie variable.

Is what I'm trying to do supported by load balancer module in Apache
2.2, can I have Apache 2.2 to stick session of BEA WL 8.1, am I missing
any configuration?

cluster.conf:
<VirtualHost *:80>
        ServerName myserver

        <Proxy balancer://itcluster>
                BalancerMember http://backend1:7070 route=be1
                BalancerMember http://backend2:7020 route=be2
        </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager
        </Location>

        ProxyPass /balancer-manager !
        ProxyPass / balancer://itcluster/
stickysession=JSESSIONID|jsessionid nofailover=On
        ProxyPassReverse / http://172.22.10.12:7045/
        ProxyPassReverse / http://172.22.10.10:7020/
 </VirtualHost>

Regards,
Tamer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org