apachejbossload-balancingjsessionidmod-cluster

Sticky session not working with multiple apache vhosts and multiple JBoss 7.2 server-groups


Having a specific cluster architecture with the following details:

In domain.xml i have the following settings (only important snippets):

    ...
        <subsystem xmlns="urn:jboss:domain:modcluster:1.1">
            <mod-cluster-config advertise-socket="modcluster" connector="ajp" balancer="${mycluster.modcluster.balancer:DefaultBalancer}" proxy-list="10.10.0.1:6677">
                <dynamic-load-provider>
                    <load-metric type="busyness"/>
                </dynamic-load-provider>
            </mod-cluster-config>
        </subsystem>
    ...
    ...
    <server-group name="SG1" profile="ha">
        <system-properties>
            <property name="mycluster.modcluster.balancer" value="SG1Balancer"/>
        </system-properties>
        <jvm name="default"/>
        <socket-binding-group ref="ha-sockets"/>
    </server-group>
    <server-group name="SG2" profile="ha">
        <system-properties>
            <property name="mycluster.modcluster.balancer" value="SG2Balancer"/>
        </system-properties>
        <jvm name="default"/>
        <socket-binding-group ref="ha-sockets"/>
    </server-group>
    ....

And in host.xml (same as in slave and host):

    ....
    <servers>
        <server name="server-1" group="SG1" auto-start="true">
            <socket-bindings port-offset="1"/>
        </server>
        <server name="server-2" group="SG2" auto-start="true">
            <socket-bindings port-offset="2"/>
        </server>
    ....

I need to point each virtual hosts to a specific server-group, so this is my solution for it:

Here's my httpd configuration sets:

loadbalancer.conf:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so

<IfModule manager_module>
  Listen 0.0.0.0:6677
  ManagerBalancerName ddrct-cluster

  <VirtualHost *:6677>
    ServerName RecetteDtvLb1
    <Location />
      Order deny,allow
      Allow from 0.0.0.0
    </Location>

    # No server advertising
    # we're using proxy-list
    ServerAdvertise Off

    KeepAliveTimeout 300
    MaxKeepAliveRequests 0
    EnableMCPMReceive

    <Location /mcm>
      SetHandler mod_cluster-manager
      Order deny,allow
      Allow from 0.0.0.0
    </Location>
  </VirtualHost>
</IfModule>

vhosts.conf:

ProxyRequests Off
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.vhost1.com

  ProxyPass / balancer://SG1Balancer stickysession=JSESSIONID
  ProxyPassReverse / balancer://SG1Balancer
  ProxyPreserveHost On

  ErrorLog "logs/vhost1_error.log"
  CustomLog "logs/vhost1_access.log" common
</VirtualHost>

<VirtualHost *:80>
  ServerName www.vhost2.com

  ProxyPass / balancer://SG2Balancer stickysession=JSESSIONID
  ProxyPassReverse / balancer://SG2Balancer
  ProxyPreserveHost On

  ErrorLog "logs/vhost2_error.log"
  CustomLog "logs/vhost2_access.log" common
</VirtualHost>

Everything is running fine, deployed apps in G1 can be used through www.vhost1.com and vice versa for G2, the problem is all about session stickyness, here are the symptoms:

Did not get too much documentation about multi-vhost and multi-server-group clustering and load balancing configurations, it was my own guess to implement such configuration, i may get it wrong ... any help ?


Solution

  • Issue resolved, from KB182813: