views:

171

answers:

2

Our proxy configuration (in httpd.conf) to send requests to 2 JBoss instances are given below is based on mod_proxy_balancer

<Proxy balancer://mycluster>
Allow from all
BalancerMember http://192.168.1.2:9080
BalancerMember http://192.168.1.2:8080
</Proxy>

ProxyPass /app balancer://mycluster/app
ProxyPassReverse /app  http://192.168.1.2:9080/app
ProxyPassReverse /app  http://192.168.1.2:8080/app 

How do I enable sticky load balancing based on session identifiers. Am I supposed to set the following flag as part of the Proxy declaration? It doesn't seem to take any effect. How would I debug to see if this is working fine.

SetEnv BALANCER_SESSION_STICKY JSESSIONID

A: 

You are on the right track, but it's not quite as easy as your example - check out this comprehensive blog for guidance as you need to do a couple of other things to get this to work...

http://www.markround.com/archives/33-Apache-mod_proxy-balancing-with-PHP-sticky-sessions.html

Sohnee
A: 

The PHP sticky sessions article was an interesting read, and that lead me to look for a JBoss specific solution. The key is having the route appended to the session value in the jsessionid param/cookie. JBoss (actually tomcat) has builtin support for this.

Add jvmRoute="" to the config in each server.xml. Then change <attribute name="UseJK">false</attribute>in jboss-service.xml to 'true'.

The whole setup is described in Using mod_proxy with JBoss.

mdma