Incorrect Round Robin behaviour observed in tcp mode - haproxy 1.2.17

From: Manuel Soto <mrsoto#yahoo.com>
Date: Fri, 9 May 2008 14:22:18 -0700 (PDT)

Hello

    I'm working in concept tests, round robin layer 3 and 7 and found in haproxy 1.2.17 that it dows not balance to one and another each time.

The test:

    Apply this request (http://10.27.31.83:8082/) several times especting that haproxy assign both servers

The result:

    Not all the reloads are redirected to the other server

============<BEGIN HTTP HEADERS (partial)>=================================================
http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: es-ar,es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Thu, 06 Jan 2005 12:11:39 GMT If-None-Match: "7a116-707-41dd2afb;48109b4b" Cache-Control: max-age=0

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:41:52 GMT
Server: Apache/1.3.37 (Unix) mod_perl/1.30 Connection: close
Etag: "7a116-707-41dd2afb;48109b4b"
Content-Location: index.html.es
Vary: negotiate, accept-language, accept-charset



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 200 OK
Date: Fri, 09 May 2008 20:42:00 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:42:01 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:42:02 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:42:06 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:42:09 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 304 Not Modified
Date: Fri, 09 May 2008 20:42:13 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
rrr



http://10.27.31.83:8080/

GET / HTTP/1.1
Host: 10.27.31.83:8080
xxx

HTTP/1.x 200 OK
Cache-Control: no-cache
Connection: close
Content-Type: text/html



http://10.27.31.83:8082/

GET / HTTP/1.1
Host: 10.27.31.83:8082
xxx

HTTP/1.x 200 OK
Date: Fri, 09 May 2008 20:42:18 GMT
Server: Apache/1.3.37 (Unix) mod_perl/1.30 rrr

============<END HTTP HEADERS>=================================================


Then, I look for HAProxy stats and observe that "Session Cumul." are migrated from one server to the other, let me explain.

First stats display

sapache1=15
sapache2=14

then I do reload the page and get the same server, haproxy's stats reports

sapache1=16
sapache2=15

but expected values are

sapache1=15
sapache2=15

I do wait until Session Cur.=0 in order to avoid Keep Alive Side effect

============<BEGIN CONFIG >=================================================
Config:
global
        daemon
        maxconn 1000      # warning: this has to be 3 times the expected value!
        log localhost local0
 
defaults
        balance roundrobin
        option  dontlognull
        redispatch
        maxconn         300
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
        stats enable
 

#Balanceo capa 7
listen srv1capa7

    bind :8081

        mode    http
        option  httpclose
        option  httplog
        retries 1
        log     global
        capture request header X-Forwarded-For len 15
        option  httpchk /check.html
    # inyeccion de cookie de la asignacion del servidor
        cookie  PROXY_SERVERID
        server  apache1 10.21.19.27:80   maxconn 2  check inter 2000 fall 3 cookie server2
        server  apache2 10.27.40.81:80   maxconn 200 check inter 2000 fall 3 cookie server14
 

#Balanceo capa 3
listen srv1capa3

    bind :8082
    log global
    mode tcp

    server sapache1     10.21.19.27:80 maxconn 2  check inter 2000 fall 3
    server sapache2     10.27.40.81:80 maxconn 200 check inter 2000 fall 3

# servicio de consulta de estadisticas del balanceador listen stats :8080

        mode http
        stats uri /
============<END CONFIG >=================================================




Later,
Manuel Soto Received on 2008/05/09 23:22

This archive was generated by hypermail 2.2.0 : 2008/05/09 23:30 CEST