HAproxy roundrobin balancing does not appear to be distributing evently
- by andrew
Hello, I know that with loaded servers, roundrobin in HAproxy (1.4.4) does not evenly distribute, but my servers are currently getting NO traffic (test setup), and roundrobin balancing does
www1,www1,www1,www1,www1,...www2,www2,www2,...,www1...
I'm verifying this by having the script being run on each server cat /etc/HOSTNAME (slackware). I need to have it switch back and forth each time to test some session stuff (stored in shared memcached) but am having trouble getting it to switch between my two web servers on each request.
global
log 127.0.0.1 local0 warning
maxconn 4096
chroot /usr/share/haproxy
pidfile /var/run/haproxy.pid
uid 99
gid 99
daemon
defaults
balance roundrobin
fullconn 100
maxconn 4096
mode http
option dontlognull
option http-server-close
option forwardfor
option redispatch
retries 3
timeout connect 5000
timeout client 20000
timeout server 60000
timeout queue 60000
stats enable
stats uri /haproxy
stats auth ***:***
frontend www *:80
log global
acl is_upload hdr_dom(host) -i uploads.site.com
acl is_api hdr_dom(host) -i api.site.com
acl is_dev hdr_dom(host) -i dev.site.com
acl is_apidev hdr_dom(host) -i apidev.site.com
use_backend uploads.site.com if is_upload
use_backend api.site.com if is_api
use_backend dev.site.com if is_dev !is_apidev
default_backend site.com
backend site.com
option httpchk HEAD /alive.php HTTP/1.1\r\nHost:site.com
server www1 1.1.1.1:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
server www2 1.1.1.2:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
backend api.site.com
option httpchk HEAD /alive.php HTTP/1.1\r\nHost:api.site.com
server www1 1.1.1.1:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
server www2 1.1.1.2:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
backend dev.site.com
option httpchk HEAD /alive.php HTTP/1.1\r\nHost:dev.site.com
server www1 1.1.1.1:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
server www2 1.1.1.2:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
backend uploads.site.com
option httpchk HEAD /alive.php HTTP/1.1\r\nHost:uploads.site.com
server www1 1.1.1.1:8080 weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
server www2 1.1.1.2:8080 backup weight 10 minconn 5 maxconn 25 check inter 2000 rise 2 fall 2
So basically, I have some different back-ends (I've verified the ACLs are working), with the default option "roundrobin" selected. I've tried removing weights, removing the minconn/maxconn/fullconn attributes for all servers (not just the backend I'm testing), tried removing the ACLs, etc. I've been testing on dev.site.com BTW.
Anyone see a reason why I can't get something like www1,www2,www1,www2,...? Also, this is one of my first questions on here, so please let me know if I left anything needed out of my post.
Thanks!