Dear,

I am currently setting up a system containing a Haproxy with three
servers in the backend. For testing purposes the whole setup is build
inside virtual machines. The load on the backend comes from a script
utilizing curl to produce 30,000 requests as fast as possible in
parallel. Haproxy balances the incoming traffic fine between my VMs
until I simulate a downtime. In this case a few requests receive 503
errors. This is no big deal for http as browsers generally try a
reconnect immediately. However for my purposes the client shall not have
any notice of a downtime. Therefore I want to make Haproxy health check
the servers before connecting them to the client. Is it possible to
achieve this with any configuration of Haproxy or additional software?

I am looking forward for any help.

Best wishes,

Niklas Dallmann

Haproxy configuration:

------------------------------

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon

        # Multhithreading
        nbproc 3
        cpu-map 1 0
        cpu-map 2 1
        cpu-map 3 2
        maxconn 600

        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private

        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL). This list is from:
        #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
        ssl-default-bind-ciphers
ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
        ssl-default-bind-options no-sslv3

defaults
        log     global
        stats enable
        stats refresh 1s
        stats uri /haproxy?stats
        mode    http
        option  dontlognull
        timeout connect 1000
        timeout client  50000
        timeout server  50000
        timeout check   1000
        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

frontend http-front
        bind *:80
        option forwardfor
        default_backend http-back
        bind-process 1

backend http-back
        balance roundrobin
        option httpchk
        server server1 10.0.2.12:80 check fall 3 rise 2
        server server2 10.0.2.13:80 check fall 3 rise 2
        server server3 10.0.2.16:80 check fall 3 rise 2
        bind-process 2 3

------------------------------


Reply via email to