We are using Apache mod_proxy_loadbalancer with 4 backend JBoss, here are the configuration in backend server:
<Proxy balancer://www>
Allow from all
BalancerMember x.11:8080/APP route=node11 timeout=600 ttl=7200
BalancerMember x.12:8080/APP route=node12 timeout=600 ttl=7200
BalancerMember x.12:8081/APP route=node122 timeout=600 ttl=7200
BalancerMember x.14:8080/APP route=node14 timeout=600 ttl=7200
ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid nofailover=On
</Proxy>
ProxyPass /APP balancer://www/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse /APP balancer://www/
Our problem is the requests not balancer, most of them goes to "node12", here are the status from balancer manager:
LoadBalancer Status for balancer://www
StickySession Timeout FailoverAttempts Method
JSESSIONID|jsessionid 0 3 byrequests
Worker URL Route RouteRedir Factor Set Status Elected To From
x.11:8080/APP node11 1 0 Ok 6500 8.3M 33M
x.12:8080/APP node12 1 0 Ok 5690 38M 8.2M
x.12:8081/APP node122 1 0 Ok 6886 8.8M 35M
x.14:8080/APP node14 1 0 Ok 6272 7.5M 35M
Does this means the load balancer not works when we using StickySessions? How can we make sure each server has same requests?
BTW: please replace x with 192.168.1 as serverfault doesn't allow add multi links.
Thanks,
Tang
Best Answer
If you are load-balancing based on requests but are persisting based on sessionid, you are not really going to see evenly spread load-balancer statistics. Each user session contains a variable amount of requests (some users may have only ran through 3 or 4 pages on the site, some might have run through 15 pages, some user profiles have more data than others, etc.,).
That being said, looking at your lb stats output (and assuming the values for node12 are reversed), your requests do look fairly well-balanced, considering persistence is active.