HAproxy timing out too quickly?

Discussion in 'Server Operation' started by vmos, May 22, 2012.

  1. vmos

    vmos Member

    Hi there, I'm having a bit of a problem with haproxy. We've got two haproxy servers pointing at 4 windows web servers. Now mostly they work fine but when the client reloads their application they insist on doing all four servers simultaneuously. I know, but we've discussed it and that's the way they're doing it.

    Now when they reload the application, sometimes they get errors that the site isn't there (because it isn't) anyway, I'm trying to figure out how to get haproxy to hold on and keep trying until it gets a valid server . So someone browsing the site will experience a wait for a new page but they won't get an error message.

    Now it takes about 15 seconds for the application to reload so I thought a timeout time of 90 seconds would be sufficient but it's not, also it's set to retry 30 times and that's hot helping either.

            log   local0
            log   local1 notice
            #log loghost    local0 info
            #maxconn 4096
            maxconn 8192 
            user haproxy
            group haproxy
            stats socket /tmp/haproxy.sock mode 777
            log     global
    #        mode    http
            option  httplog
            option  dontlognull
            retries 25
            option redispatch
            #maxconn 2000
            maxconn 5000
            contimeout      100000
            clitimeout      100000
           # clitimeout      50000
            srvtimeout      100000
           # srvtimeout      50000
    listen webfarm
           mode http
           stats enable
           stats auth tibus:IgsbiW85
           stats auth myhome:myh0m3m0n
           balance roundrobin
           cookie JSESSIONID prefix
           option httpclose
           option abortonclose
           option forwardfor
           option httpchk HEAD /check.txt HTTP/1.0
           server webA cookie A check
           server webB cookie C check
           server webC cookie C check
           server webD cookie D check
           errorloc302 503 http://www.MYSITE.com/
    listen HTTPS
    #        mode http
            mode tcp
            balance roundrobin
            option httpclose
            option forwardfor
            server webA check
            server webB check
            server webC check
           server webD check
           errorloc302 503 http://www.MYSITE.com/

    any suggestions as to where I'm going wrong?
  2. wtarreau

    wtarreau New Member

    I think you could get away with it by significantly increasing the number of retries and by increasing the health check retries, so as to cover the quick restart. You don't want haproxy to see your servers as down at any point since it won't even try to connect and will immediately return 503. But as long as it believes they're still up and tries to connect multiple times, it should work.

    It's not the best you can do for high availability, but your customer seems to know what's best (ie: break availability to be able to deploy in one click). So let him get harmed by his stupidity and next time he'll listen to your advices which are much smarter than his ignorance.

Share This Page