Sticky sessions not working with JBoss EAP 6.4 Domain + Apache mod_cluster with session replication
gian.honorio May 9, 2019 11:21 AMI have an environment with a JBoss EAP 6.4 domain controlling 4 nodes, and to perform the load balancing between cluster members I'm using Apache with the mod_cluster. After all configured the application worked correctly with load balancing and session replication, but the sessions are not sticky, every request made by the same client is being sent to a different server, which causes the requests to be very slow and time consuming.
jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd"
version="6.0">
<context-root>app/server</context-root>
<replication-config>
<replication-trigger>SET_AND_GET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
</replication-config>
</jboss-web>
domain.xml
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" proxy-list="192.168.8.91:6666" balancer="appclustergroup" sticky-session="true" sticky-session-force="false" connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
httpd.conf
<IfModule manager_module>
Listen 6666
ManagerBalancerName appclustergroup
KeepAliveTimeout 5
MaxKeepAliveRequests 0
ProxyPreserveHost On
ProxyPass / balancer://appclustergroup/app/ stickysession=JSESSIONID|jsessionid
ProxyPassReverse / balancer://appclustergroup/app/
ProxyPassReverseCookiePath / /
<VirtualHost *:6666>
EnableMCPMReceive on
AdvertiseFrequency 30
<Location />
Require all granted
</Location>
<Location /modcluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from 192.168.0.0/23
Require all granted
</Location>
</VirtualHost>
</IfModule>
Am I forgetting anything to make the sticky sessions work properly? Every help is welcome. Thanks!