Re: HAProxy for persistent TCP connections

From: Willy Tarreau <w#1wt.eu>
Date: Mon, 8 Mar 2010 07:16:34 +0100


Hello,

On Sun, Mar 07, 2010 at 08:46:08PM -0500, Geoffrey Mina wrote:
> Hello,
> I am evaluating HAProxy for an application which utilizes persistent
> TCP connections. We often go days, weeks, or even months without
> causing a TCP disconnect/reconnect. Any issues I should be aware of
> before I get too far down the path? This will just be straight TCP
> load-balancing, no HTTP involved.

Having some connections remain established for months is not an issue at all. However you should still be careful about your timeouts, because if a connection remains inactive for a long time, there is no was to distinguish that from a frozen connection. So maybe you can set large timeouts of 1 hour, 1 day or something like this in order to get rid of dead connections without having to restart the process. The largest timeout you can set is 24 days, due to the internal precision of one millisecond.

You should also enable tcp keepalives (option tcpka) so that the system regularly tests connections. By default, some systems send them every 2 hours, and actively kill the connection after several failures.

You should also be careful about your config changes, because if you restart, you'll break your connections (unless you restart with -sf, but it will be hard to troubleshoot when running multiple concurrent processes).

Regards,
Willy Received on 2010/03/08 07:16

This archive was generated by hypermail 2.2.0 : 2010/03/08 07:30 CET