We have Apache running as reverse proxy using proxy balancer we run a jMeter load test from 7 Cloud machines but the traffic does not seem to get distributed evenly I'm thinking it's an Apache config issue, but not sure what
Basically in our VirtualHost directive I have:
ProxyPreserveHost on
ProxyRequests Off
ProxyPass / balancer://my-site/
ProxyPassReverse / balancer://my-site/
Header add Set-Cookie "route=.%{BALANCER_WORKER_ROUTE}e; path=/"
and
<Proxy balancer://my-site>
BalancerMember https://MYMACHINE:8443 route=1 loadfactor=20
BalancerMember https://MYMACHINE:8443 route=2 loadfactor=20
ProxySet stickysession=route
</Proxy>
At first it did not have loadfactor=20 and load balancing was not done well
after I added it there was improvement, but not great. Traffic would still get routed to 1-2 machines more then the others (we have a total of 5 machines).
Best Answer
Since you're running sticky sessions, you can't expect for the workload on each member to be exactly even. If I understand you right, you have 7 machines making requests and 5 machines in the balancer to answer those requests - if that's the case, then 3 servers get 1 client each and 2 servers get 2 clients each - so that would be completely expected.
This will even out as node count increases, but it's impossible to get a perfectly even distribution when you're using sticky session.
The dynamic assignment of a request takes into account assigned request counts by default, but obviously can't make a change to a node after it's been stickied; it's not counting how many nodes have been stuck to each backend.
You can try adding
ProxySet lbmethod=bybusyness
to your<Proxy balancer://my-site>
configuration; this may help to even things out a bit more for higher loads (but won't change anything when you're dealing with such low client counts).