<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>HAProxy for persistent TCP connections</title>
        <description> 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.

thanks.</description>
        <link>http://www.serverphorums.com/read.php?10,114556,114556#msg-114556</link>
        <lastBuildDate>Wed, 22 May 2013 21:25:41 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,127689#msg-127689</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,127689#msg-127689</link>
            <description><![CDATA[ Great.  I guess I wasn't clear on what those actually did.  I will try<br />
increasing those numbers and see if things get better.<br />
<br />
gracias!<br />
Geoff<br />
<br />
On Wed, Mar 31, 2010 at 6:03 PM, Cyril Bonté &lt;cyril.bonte@free.fr&gt; wrote:<br />
<br />
&gt; Hi,<br />
&gt;<br />
&gt; Le Mercredi 31 Mars 2010 23:33:05, Geoffrey Mina a écrit :<br />
&gt; &gt; Willy,<br />
&gt; &gt; I know you said that HAProxy would work just fine with persistent TCP<br />
&gt; &gt; connections, unfortunately I am not seeing that behavior. We are<br />
&gt; &gt; establishing a socket connection and sending application level &quot;heart<br />
&gt; beat&quot;<br />
&gt; &gt; messages every 60 seconds.<br />
&gt;<br />
&gt; Isn't it every 30 seconds, with a &quot;BEAT&quot; message coming from the backend ?<br />
&gt;<br />
&gt; &gt; I am seeing that HAProxy is shutting down my<br />
&gt; &gt; connection after a period of time.  Attached is a pcap file of the<br />
&gt; &gt; shutdown... from the HAProxy server.  I have also included my<br />
&gt; configuration<br />
&gt; &gt; below.<br />
&gt;<br />
&gt; If it's 30 seconds, then &quot;srvtimeout  30000&quot; is not a good value, as<br />
&gt; HAProxy can close the connection nearly at the same time the packet is<br />
&gt; received.<br />
&gt; Can you try with a value a little bigger than the heart beat interval ?<br />
&gt; And if it's 60 seconds, this timeout is definitly too low.<br />
&gt;<br />
&gt; --<br />
&gt; Cyril Bonté<br />
&gt;]]></description>
            <dc:creator>Geoffrey Mina</dc:creator>
            <category>HAProxy</category>
            <pubDate>Thu, 01 Apr 2010 01:00:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,127664#msg-127664</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,127664#msg-127664</link>
            <description><![CDATA[ Hi,<br />
<br />
Le Mercredi 31 Mars 2010 23:33:05, Geoffrey Mina a écrit :<br />
&gt; Willy,<br />
&gt; I know you said that HAProxy would work just fine with persistent TCP<br />
&gt; connections, unfortunately I am not seeing that behavior. We are<br />
&gt; establishing a socket connection and sending application level &quot;heart beat&quot;<br />
&gt; messages every 60 seconds.<br />
<br />
Isn't it every 30 seconds, with a &quot;BEAT&quot; message coming from the backend ?<br />
<br />
&gt; I am seeing that HAProxy is shutting down my<br />
&gt; connection after a period of time.  Attached is a pcap file of the<br />
&gt; shutdown... from the HAProxy server.  I have also included my configuration<br />
&gt; below.<br />
<br />
If it's 30 seconds, then &quot;srvtimeout  30000&quot; is not a good value, as HAProxy can close the connection nearly at the same time the packet is received.<br />
Can you try with a value a little bigger than the heart beat interval ?<br />
And if it's 60 seconds, this timeout is definitly too low.<br />
<br />
-- <br />
Cyril Bonté]]></description>
            <dc:creator>Cyril Bonté</dc:creator>
            <category>HAProxy</category>
            <pubDate>Thu, 01 Apr 2010 00:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,127651#msg-127651</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,127651#msg-127651</link>
            <description><![CDATA[ Willy,<br />
I know you said that HAProxy would work just fine with persistent TCP<br />
connections, unfortunately I am not seeing that behavior. We are<br />
establishing a socket connection and sending application level &quot;heart beat&quot;<br />
messages every 60 seconds.  I am seeing that HAProxy is shutting down my<br />
connection after a period of time.  Attached is a pcap file of the<br />
shutdown... from the HAProxy server.  I have also included my configuration<br />
below.<br />
<br />
Any ideas on what's up here?<br />
<br />
<br />
global<br />
        maxconn     4096 # Total Max Connections. This is dependent on<br />
ulimit<br />
        daemon<br />
        nbproc      4 # Number of processing cores. Dual Dual-core Opteron<br />
is 4 cores for example.<br />
        log 127.0.0.1 local0 debug<br />
<br />
defaults<br />
        mode        http<br />
        clitimeout  150000<br />
        srvtimeout  30000<br />
        contimeout  4000<br />
        log     global<br />
        #option tcplog<br />
        #option         httplog<br />
        #option      httpclose # Disable Keepalive<br />
<br />
<br />
listen  services X.X.X.131:1312<br />
        mode tcp<br />
        balance roundrobin # Load Balancing algorithm<br />
        option tcpka<br />
        retries 3<br />
        ## Define your servers to balance<br />
        server rs-webserver1 X.X.X.217:1312<br />
        server rs-webserver2 X.X.X.216:1312<br />
        server rs-webserver3 X.X.X.136:1312<br />
        server rs-webserver4 X.X.X.220:1312<br />
        server rs-webserver5 X.X.X.126:1312<br />
<br />
<br />
listen stats :8080<br />
        mode http<br />
        stats uri /<br />
<br />
<br />
<br />
Thanks!<br />
Geoff<br />
<br />
On Tue, Mar 9, 2010 at 6:03 PM, Willy Tarreau &lt;w@1wt.eu&gt; wrote:<br />
<br />
&gt; On Tue, Mar 09, 2010 at 05:58:07PM -0500, Geoffrey Mina wrote:<br />
&gt; &gt; Great.  None of this should be an issue.  My application sends it's<br />
&gt; &gt; own keepalive/heartbeat packets every 30-60 seconds.  So, it sounds<br />
&gt; &gt; like the timeout will only kick in if there is no activity on the<br />
&gt; &gt; socket, correct?  If that's the case, then I'll probably have fairly<br />
&gt; &gt; short timeout settings, to ensure we don't have a bunch of garbage<br />
&gt; &gt; connections up.<br />
&gt;<br />
&gt; yes indeed that's better that way. And it's nice to see that some<br />
&gt; people still think about implementing application level keep-alives !<br />
&gt;<br />
&gt; Willy<br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Geoffrey Mina</dc:creator>
            <category>HAProxy</category>
            <pubDate>Wed, 31 Mar 2010 23:40:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,115570#msg-115570</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,115570#msg-115570</link>
            <description><![CDATA[ On Tue, Mar 09, 2010 at 05:58:07PM -0500, Geoffrey Mina wrote:<br />
&gt; Great.  None of this should be an issue.  My application sends it's<br />
&gt; own keepalive/heartbeat packets every 30-60 seconds.  So, it sounds<br />
&gt; like the timeout will only kick in if there is no activity on the<br />
&gt; socket, correct?  If that's the case, then I'll probably have fairly<br />
&gt; short timeout settings, to ensure we don't have a bunch of garbage<br />
&gt; connections up.<br />
<br />
yes indeed that's better that way. And it's nice to see that some<br />
people still think about implementing application level keep-alives !<br />
<br />
Willy]]></description>
            <dc:creator>Willy Tarreau</dc:creator>
            <category>HAProxy</category>
            <pubDate>Wed, 10 Mar 2010 00:10:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,115566#msg-115566</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,115566#msg-115566</link>
            <description><![CDATA[ Great.  None of this should be an issue.  My application sends it's<br />
own keepalive/heartbeat packets every 30-60 seconds.  So, it sounds<br />
like the timeout will only kick in if there is no activity on the<br />
socket, correct?  If that's the case, then I'll probably have fairly<br />
short timeout settings, to ensure we don't have a bunch of garbage<br />
connections up.<br />
<br />
thanks.<br />
<br />
On Mon, Mar 8, 2010 at 1:16 AM, Willy Tarreau &lt;w@1wt.eu&gt; wrote:<br />
&gt; Hello,<br />
&gt;<br />
&gt; On Sun, Mar 07, 2010 at 08:46:08PM -0500, Geoffrey Mina wrote:<br />
&gt;&gt; Hello,<br />
&gt;&gt; I am evaluating HAProxy for an application which utilizes persistent<br />
&gt;&gt; TCP connections.  We often go days, weeks, or even months without<br />
&gt;&gt; causing a TCP disconnect/reconnect.  Any issues I should be aware of<br />
&gt;&gt; before I get too far down the path?  This will just be straight TCP<br />
&gt;&gt; load-balancing, no HTTP involved.<br />
&gt;<br />
&gt; Having some connections remain established for months is not an issue<br />
&gt; at all. However you should still be careful about your timeouts, because<br />
&gt; if a connection remains inactive for a long time, there is no was to<br />
&gt; distinguish that from a frozen connection. So maybe you can set large<br />
&gt; timeouts of 1 hour, 1 day or something like this in order to get rid<br />
&gt; of dead connections without having to restart the process. The largest<br />
&gt; timeout you can set is 24 days, due to the internal precision of one<br />
&gt; millisecond.<br />
&gt;<br />
&gt; You should also enable tcp keepalives (option tcpka) so that the<br />
&gt; system regularly tests connections. By default, some systems send<br />
&gt; them every 2 hours, and actively kill the connection after several<br />
&gt; failures.<br />
&gt;<br />
&gt; You should also be careful about your config changes, because if you<br />
&gt; restart, you'll break your connections (unless you restart with -sf,<br />
&gt; but it will be hard to troubleshoot when running multiple concurrent<br />
&gt; processes).<br />
&gt;<br />
&gt; Regards,<br />
&gt; Willy<br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Geoffrey Mina</dc:creator>
            <category>HAProxy</category>
            <pubDate>Wed, 10 Mar 2010 00:00:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,114594#msg-114594</guid>
            <title>Re: HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,114594#msg-114594</link>
            <description><![CDATA[ Hello,<br />
<br />
On Sun, Mar 07, 2010 at 08:46:08PM -0500, Geoffrey Mina wrote:<br />
&gt; Hello,<br />
&gt; I am evaluating HAProxy for an application which utilizes persistent<br />
&gt; TCP connections.  We often go days, weeks, or even months without<br />
&gt; causing a TCP disconnect/reconnect.  Any issues I should be aware of<br />
&gt; before I get too far down the path?  This will just be straight TCP<br />
&gt; load-balancing, no HTTP involved.<br />
<br />
Having some connections remain established for months is not an issue<br />
at all. However you should still be careful about your timeouts, because<br />
if a connection remains inactive for a long time, there is no was to<br />
distinguish that from a frozen connection. So maybe you can set large<br />
timeouts of 1 hour, 1 day or something like this in order to get rid<br />
of dead connections without having to restart the process. The largest<br />
timeout you can set is 24 days, due to the internal precision of one<br />
millisecond.<br />
<br />
You should also enable tcp keepalives (option tcpka) so that the<br />
system regularly tests connections. By default, some systems send<br />
them every 2 hours, and actively kill the connection after several<br />
failures.<br />
<br />
You should also be careful about your config changes, because if you<br />
restart, you'll break your connections (unless you restart with -sf,<br />
but it will be hard to troubleshoot when running multiple concurrent<br />
processes).<br />
<br />
Regards,<br />
Willy]]></description>
            <dc:creator>Willy Tarreau</dc:creator>
            <category>HAProxy</category>
            <pubDate>Mon, 08 Mar 2010 07:20:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,114556,114556#msg-114556</guid>
            <title>HAProxy for persistent TCP connections</title>
            <link>http://www.serverphorums.com/read.php?10,114556,114556#msg-114556</link>
            <description><![CDATA[ Hello,<br />
I am evaluating HAProxy for an application which utilizes persistent<br />
TCP connections.  We often go days, weeks, or even months without<br />
causing a TCP disconnect/reconnect.  Any issues I should be aware of<br />
before I get too far down the path?  This will just be straight TCP<br />
load-balancing, no HTTP involved.<br />
<br />
thanks.]]></description>
            <dc:creator>Geoffrey Mina</dc:creator>
            <category>HAProxy</category>
            <pubDate>Mon, 08 Mar 2010 02:50:01 +0100</pubDate>
        </item>
    </channel>
</rss>
