I am using haproxy 1.5-dev21, and it seems like health check only
happens immediately on startup / after reload for the first backend
defined.

Let's say we have the following haproxy.cfg:

defaults
        log global
        timeout connect 5s
        timeout client 30s

frontend portal :8080
        mode http
        option httplog
        option forwardfor
        option http-server-close
        default_backend rails

backend rails
        mode http
        balance roundrobin
        timeout server 300s
        option redispatch
        option httpchk GET /health_check
        server xxx x.x.x.x:80 check # nginx with bad upstream, returns 502
        server yyy y.y.y.y:80 check backup # nginx with good upstream

With `siege http://localhost:8080/` running on a separate console, we
can keep restarting / reloading haproxy without getting any 502
response. The backup server will always take over.

Next, we add the following dummy config to haproxy.cfg, below the
defaults section:

frontend dummy_frontend :1234
        mode tcp
        option tcplog
        default_backend dummy_backend

backend dummy_backend
        mode tcp
        balance roundrobin
        timeout server 30s
        server dummy localhost:5678 check

With `siege http://localhost:8080/` running on a separate console, we
now get a bunch of 502 responses with each restart / reload of
haproxy. It seems like health check for the rails backend doesn't
happen immediately after startup / reload anymore. The gap is much
smaller than the default health check interval of 2 seconds, but there
is still a gap.

Reply via email to