HAProxy Enterprise Documentation 2.2r1

Retry a Failed Connection

HAProxy Enterprise uses intermittent health checks to monitor each backend server's connectivity and remove problematic servers from the load balancing rotation. This action stops the flow of client traffic to servers experiencing long-lasting connection problems. Nevertheless, not all connection problems are long lasting. HAProxy Enterprise can attempt to overcome short-term connection problems by simply retrying the connection again.

Connection retries are enabled by default, but you can increase or decrease the number of times HAProxy Enterprise performs a retry:

  1. In a defaults or backend section of your load balancer configuration, set the retries directive to the number of times to retry a failed connection attempt.

    Attempt to connect to the server 5 times before giving up and returning Service Unavailable to the client.

    backend webservers
       retries 5
  2. Optional: Add the timeout connect directive to set the delay between retries.

    The server performs the next retry after 3 seconds, optimistically giving the server time to overcome short-term connectivity issues.

    backend webservers
       timeout connect 3
  3. Optional: Add the option redispatch directive to instruct HAProxy Enterprise to retry with a different server until it finds one to which it can connect.

    The option redispatch directive tells HAProxy Enterprise to dispatch the request to another server after 2 failed retries.

    backend webservers
       option redispatch 2

Next up

Retry a Failed HTTP Request