Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As per various blogs, HAproxy can be gracefully restarted using the following command:

sudo haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/ -sf $(cat /var/run/

TO verify this, I had set up a apache bench script which contiguously sent message to haproxy. Ideally, whenever I restarted my server the script should not have an affect on the apache bunch execiton. But, it seems that whenever Haproxy is restarted apache bench scripts terminate and the connection to load balancer is lost.

Here is the details of my HaProxy configuration file :

    nbproc 4
    log   local0
    log   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    user haproxy
    group haproxy
    pidfile /var/run/
    stats socket /home/ubuntu/haproxy.sock

    log     global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000

    listen webstats
    stats enable
    mode http
    stats uri /lb?stats
    stats auth anand:aaaaaaaa
    #stats refresh

    listen web-farm
         mode http
         balance roundrobin
         option httpchk HEAD /index.php HTTP/1.0

Please let me know what am I missing here.

share|improve this question

migrated from Nov 14 '11 at 17:14

This question came from our site for professional and enthusiast programmers.

Do you enable keepalive in ab? – minaev Dec 16 '11 at 9:44

While troubleshooting this, try to use "nbproc 1" instead of "nbproc 4", increasing the number of processes is rarely needed, and could potentially lead to issues in certain cases.

However, this is most likely not the main problem. The scenario you describe should actually work as you expect.

HAProxy's hot reconfiguration actually works like this :

  1. A new process is started with the specified configuration
  2. The old process receives a SIGTTOU signal so that the new process can take over the port(s)
  3. The old process finishes it's current work and then exits
  4. The new process handles traffic over the port(s)

If anything goes wrong after 2, the old process instead receives a SIGTTIN signal, and continues as before.

Some additional detail in your question could make troubleshooting this problem easier:

  • What parameters do you use with ab
  • After a hot reconfiguration, can you connect to the new process with any other clients or not
  • Which (major) version of HAProxy are you using
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.