The domain directive feature of UsingMod_jk1.2WithJBoss (available since version 1.2.8) is an optimization that allows you to divide a large number of workers into groups to minimize the bandwidth costs of session replication. Rather than replicating sessions to all node, sessions only need to be replicated to members of the same domain. If a node fails, the load balancer will failover to a node with the same domain, if possible. This is used in concert with Buddy Replication and Session Data, where each buddy group corresponds to a domain.
The domain directive should always be used with sticky session enabled. Subsequent requests for a given session will always route to the same node (as it would if no domain was used). If that node become unavailable, requests for that session will failover to a another node with the same domain. If no other nodes exist with the same domain, then the request will be balanced to some node from another domain.
Domains are defined in workers.properties:
e.g.
worker.list=balancer,status worker.node1.type=ajp13 worker.node1.host=server1 worker.node1.port=8009 worker.node1.domain=group1 worker.node2.type=ajp13 worker.node2.host=server2 worker.node2.port=8009 worker.node2.domain=group1 worker.node3.type=ajp13 worker.node3.host=server3 worker.node3.port=8009 worker.node3.domain=group2 worker.node4.type=ajp13 worker.node4.host=server4 worker.node4.port=8009 worker.node4.domain=group2 worker.balancer.type=lb worker.balancer.balance_workers=node1,node2,node3,node4 worker.balancer.sticky_session=True worker.status.type=status
The corresponding JBoss Web configuration for node1 might look like:
<Server> <Service name="jboss.web"> <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" connectionTimeout="20000" redirectPort="8443"/> <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443"/> <Engine name="jboss.web" defaultHost="server1" jvmRoute="node1"> <!-- ... --> </Engine> </Service> </Server>
Comments