On Wed, Aug 6, 2014 at 1:24 AM, Bryan Talbot <[email protected]> wrote: > On Tue, Aug 5, 2014 at 7:12 AM, Luis Silva <[email protected]> wrote: >> >> Hi guys, >> >> I'm trying to use HAProxy to load balance based on the source address. >> >> backend bk_ws >> balance source >> >> option httpchk GET / >> server wsc1 10.174.82.15:8001 maxconn 30000 weight 10 check port 8001 >> inter 60s fall 1 >> server wsc2 10.174.82.16:8051 maxconn 30000 weight 10 check port 8051 >> inter 60s fall 1 >> >> I'm sending the request from 3 different sources, but all of them are >> being sent to the first server. Both servers are up. >> >> > > > My guess is that you're just getting unlucky. Since your sample size is so > small, it's quite possible that all 3 source addresses end up hashed to the > same server. At most, you could expect up to 1 of the 3 source IPs to be on > server "one" and the other 2 on server "two". The hashes are not fair when > the input cardinality is so small. > > -Bryan >
I agree with Bryan, if the IPs are very close, the hash may not be very good. You could give a try to other hash algorithm available in HAProxy and also playing with server's weight. Since the weight is used when computing the hash, then there is a chance you balance your traffic better (this is for your test phase only). Also, you could add the same servers multiple times to create a farm with 10 servers and retry your test with your few IP addresses. Stupid question... Are you sure your server2 is up and running from an HAProxy point of view? Baptiste

