Connection churn issue

I am facing connection churn issue when I am using keep-alive and http-tunnel introduces un-even load balancing at the backend.

Should I use below -

option http-keep-alive
optiuon http-server-close
http-reuse always

You have to provide more details for us to be able to give you a recommendation. Start with providing the rest of your configuration, especially related to load-balancing.

Here is my current setup


global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /var/run/haproxy.sock mode 600 level admin
user haproxy
group haproxy
daemon
maxconn 20000

defaults
log global
mode http
retries 3

option http-keep-alive

option httplog

option dontlognull

option http-tunnel
option  redispatch
    option  forwardfor
option httpclose
    timeout  connect 10000
    timeout  client  10000
    timeout  server  10000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

#------------------

internal statistics

#------------------
listen stats
bind XXXXXXXXXXXX:9999
mode http
stats enable
stats uri /haproxy?stats
#------------------

frontend instances

#------------------
frontend test_ha
bind XXXXXXXXXXXX:8090
default_backend test_back

#------------------

backend instances

#------------------
backend test_back
balance roundrobin
option http-keep-alive
#option http-tunnel
http-reuse always

option allbackups

option tcp-smart-connect

option prefer-last-server
server test1 XXXXXXXXXXXX:80 check port 80
server test2 XXXXXXXXXXXX.:80 check port 80
server test3 XXXXXXXXXXXX:80 check port 80 
server test4 XXXXXXXXXXXX:80 check port 80 

Our requirement is to achieve even load balancing with a minimal number of RST at the backend. we are able to achieve it with http-tunnel option but that doesn’t honor load balancing when traffic is very high.

Then you cannot use roundrobin. Replace balance roundrobin with balance leastconn and if that is not enough, remove option prefer-last-server.

1 Like