<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>killing persisent conections on backends marked down?</title>
        <description> hi willy and friends,

i am working on a set of ruby scripts to do database failover and
stonith. so far all is working pretty well, but i have a few issues:

1) rails makes persistent connections to the backend database so when
a server is marked down, the connection remains ongoing. currently, i
deal with this by issuing a &amp;quot;stonith&amp;quot; command in my ruby &amp;quot;driver&amp;quot;
script for haproxy that shuts the backend down explicitly via ssh, but
it would be nice if i could rely on haproxy to kill the connection
explicitly. is there a setting to make haproxy kill existing
connections on a backend going down?

2) for rails i have tcp timeout set to 0 so it seems to be handling
the persistent connections ok, but when i do a reload using the
haproxy init script in the debian packages, i end up with two haproxy
backends as the persistent connections aren't killed. essentially the
original process is waiting for the connections to end before it kills
itself, but that will never happen with rails db connection. any ideas
or suggestions?

ps: having rails not use persistent connections is not really what i
would like to do right now. i have run that in the past on production
and had wierd timeout problems and choppy connectivity.

thanks...gg

-- 
greg gard, psyd
www.carepaths.com</description>
        <link>http://www.serverphorums.com/read.php?10,109807,109807#msg-109807</link>
        <lastBuildDate>Wed, 22 May 2013 13:46:27 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,452874#msg-452874</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,452874#msg-452874</link>
            <description><![CDATA[ Hi Willy,<br />
<br />
&gt;&gt; is it possible for haproxy to failover to a backup,<br />
&gt;&gt; but not failback even if the server is alive again?<br />
<br />
I have the same problem.<br />
I would like for my primary to be detected as UP, but not do the failback<br />
immediately. Is it possible to failback to the primary only when the backup<br />
becomes unhealthy?<br />
<br />
I use HAProxy with two mysql servers in Active/Backup configuration.<br />
Sometimes, the primary mysql-server's CPU utilization increases a lot and it is<br />
unable to service queries quickly enough. The queries and connections pile up<br />
and exceed max_connections limit.<br />
My HAProxy detects this as an unhealthy condition and fails over to the<br />
mysql-server backup.<br />
At this point, the primary mysql-server slowly processes a couple of queries and<br />
the number of connections reduces to a value that is just below max_connections.<br />
HAPRoxy's health check goes through and determines the primary to be healthy and<br />
failback happens to an already overloaded primary.<br />
When this happens, inevitably the primary chokes again in a couple of seconds<br />
and a failover happens once again to the backup .. and the process repeats.<br />
<br />
I think that in this case, it would be great if HAProxy stayed with the<br />
mysql-server backup and switched back only when the backup becomes unhealthy.<br />
<br />
Is it possible to configure HAProxy to stick with the backup and not failback ?<br />
<br />
Thanks<br />
Siva<br />
<br />
Willy Tarreau &lt;w &lt;at&gt; 1wt.eu&gt; writes:<br />
<br />
&gt; <br />
&gt; On Thu, Feb 25, 2010 at 10:05:02PM -0500, Greg Gard wrote:<br />
&gt; &gt; sorry willy i sent this to wrong address. here is my other question:<br />
&gt; &gt; <br />
&gt; &gt; one more thing. is it possible for haproxy to failover to a backup,<br />
&gt; &gt; but not failback even if the server is alive again? for example, if i<br />
&gt; &gt; could set rise to be infinite so that once it was down, it was down<br />
&gt; &gt; for good? currently, i am handling this with a text file that gets<br />
&gt; &gt; written and once there forces my ruby db checker to return 5xx to<br />
&gt; &gt; haproxy. can you all think of any better way to deal with this withing<br />
&gt; &gt; haproxy?<br />
&gt; <br />
&gt; Well, there's no easy way to do this, but more importantly you don't<br />
&gt; describe how you want to proceed to put the service back online after<br />
&gt; the issue. Obviously you won't leave your server dead forever in a<br />
&gt; rack and through it to the bin every time it fails. So &quot;infinite&quot;<br />
&gt; here is still the wrong solution. I have a feeling that in fact<br />
&gt; you're trying to use haproxy more as a fuse or an on/off switch<br />
&gt; than for what it's designed.<br />
&gt; <br />
&gt; I really believe that you have to rethink the whole lifecycle of<br />
&gt; your components and write down rules indicating after what event<br />
&gt; you consider them dead, and after what event you consider them<br />
&gt; usable again. You also have to identify if certain maintenance<br />
&gt; operations are needed during the up-&gt;dead or dead-&gt;up transition.<br />
&gt; Think of it just as if someone else was managing your haproxy and<br />
&gt; you couldn't call him every day to stop/start/change configs.<br />
&gt; <br />
&gt; That's the only way you'll manage to get a reliable and easily<br />
&gt; manageable application.<br />
&gt; <br />
&gt; Regards,<br />
&gt; Willy<br />
&gt; <br />
&gt;]]></description>
            <dc:creator>Siva</dc:creator>
            <category>HAProxy</category>
            <pubDate>Tue, 28 Feb 2012 10:40:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,110234#msg-110234</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,110234#msg-110234</link>
            <description><![CDATA[ hi,<br />
<br />
just a followup with a solution that might save some other rails dude some<br />
time. the fix below allows you to set the same timeouts for db connections<br />
as you have for your webserver backends without major invasive surgery to<br />
what rails expects (ie a persistent connection to db).<br />
<br />
turns out that ActiveRecord has a verify_active_connections! method that<br />
will cycle through all connections/pools defined by your database.yml config<br />
file and restart them if needed. not quite sure whether this actually dumps<br />
an existing one or not, but it does restart a connection that has timed<br />
out.<br />
<br />
so i hacked the default rails session store (rails 2.3.4) like so:<br />
/vendor/rails/active_record/lib/active_record/session_store.rb (line<br />
<br />
def find_by_session_id(session_id)<br />
  begin<br />
    find :first, :conditions =&gt; {:session_id=&gt;session_id}<br />
  rescue<br />
    verify_active_connections!<br />
    find :first, :conditions =&gt; {:session_id=&gt;session_id}<br />
  end<br />
end<br />
<br />
anyway, this makes for a pretty smooth transition when doing failover as<br />
well as avoiding 5xx errors the first request to an inactive server for<br />
which haproxy has timed out the db connection.<br />
<br />
thanks for the input and keep up the great work. once i get my drivers<br />
working, i will post a link to the code.<br />
<br />
....gg<br />
<br />
2010/2/26 XANi &lt;xani666@gmail.com&gt;<br />
<br />
&gt;  Hi<br />
&gt; Dnia 2010-02-25, czw o godzinie 21:07 -0500, Greg Gard pisze:<br />
&gt;<br />
&gt; hi guys,<br />
&gt;<br />
&gt; thanks for the feedback. yet another rails issue that makes deployment<br />
&gt; a hassle. my biggest issue with setting the timeouts is that when a<br />
&gt; user hits the page after a timeout, they will get a 5xx error, but<br />
&gt; perhaps i can teach rails to catch the exception and retry the<br />
&gt; connection. anyway, thanks for clarifying that i wasn't missing some<br />
&gt; simple config option.<br />
&gt;<br />
&gt; ...gg<br />
&gt;<br />
&gt;<br />
&gt;  That's certainly is a good thing even if u don't use proxy between ur SQL<br />
&gt; and app :)<br />
&gt;<br />
&gt; Regards<br />
&gt; Mariusz<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt;   --<br />
&gt; Mariusz Gronczewski (XANi) &lt;xani666@gmail.com&gt;<br />
&gt; GnuPG: 0xEA8ACE64<a href="http://devrandom.pl" target="_blank"  rel="nofollow">http://devrandom.pl</a><br />
&gt;<br />
&gt;<br />
<br />
<br />
-- <br />
greg gard, psyd<br />
www.carepaths.com]]></description>
            <dc:creator>Greg Gard</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 15:20:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,110080#msg-110080</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,110080#msg-110080</link>
            <description><![CDATA[ Hi<br />
Dnia 2010-02-25, czw o godzinie 21:07 -0500, Greg Gard pisze:<br />
<br />
&gt; hi guys,<br />
&gt; <br />
&gt; thanks for the feedback. yet another rails issue that makes deployment<br />
&gt; a hassle. my biggest issue with setting the timeouts is that when a<br />
&gt; user hits the page after a timeout, they will get a 5xx error, but<br />
&gt; perhaps i can teach rails to catch the exception and retry the<br />
&gt; connection. anyway, thanks for clarifying that i wasn't missing some<br />
&gt; simple config option.<br />
&gt; <br />
&gt; ...gg<br />
&gt; <br />
<br />
That's certainly is a good thing even if u don't use proxy between ur<br />
SQL and app :)<br />
<br />
Regards<br />
Mariusz<br />
<br />
<br />
<br />
-- <br />
Mariusz Gronczewski (XANi) &lt;xani666@gmail.com&gt;<br />
GnuPG: 0xEA8ACE64<br />
<a href="http://devrandom.pl" target="_blank"  rel="nofollow">http://devrandom.pl</a>]]></description>
            <dc:creator>XANi</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 10:50:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,110021#msg-110021</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,110021#msg-110021</link>
            <description><![CDATA[ On Thu, Feb 25, 2010 at 10:05:02PM -0500, Greg Gard wrote:<br />
&gt; sorry willy i sent this to wrong address. here is my other question:<br />
&gt; <br />
&gt; one more thing. is it possible for haproxy to failover to a backup,<br />
&gt; but not failback even if the server is alive again? for example, if i<br />
&gt; could set rise to be infinite so that once it was down, it was down<br />
&gt; for good? currently, i am handling this with a text file that gets<br />
&gt; written and once there forces my ruby db checker to return 5xx to<br />
&gt; haproxy. can you all think of any better way to deal with this withing<br />
&gt; haproxy?<br />
<br />
Well, there's no easy way to do this, but more importantly you don't<br />
describe how you want to proceed to put the service back online after<br />
the issue. Obviously you won't leave your server dead forever in a<br />
rack and through it to the bin every time it fails. So &quot;infinite&quot;<br />
here is still the wrong solution. I have a feeling that in fact<br />
you're trying to use haproxy more as a fuse or an on/off switch<br />
than for what it's designed.<br />
<br />
I really believe that you have to rethink the whole lifecycle of<br />
your components and write down rules indicating after what event<br />
you consider them dead, and after what event you consider them<br />
usable again. You also have to identify if certain maintenance<br />
operations are needed during the up-&gt;dead or dead-&gt;up transition.<br />
Think of it just as if someone else was managing your haproxy and<br />
you couldn't call him every day to stop/start/change configs.<br />
<br />
That's the only way you'll manage to get a reliable and easily<br />
manageable application.<br />
<br />
Regards,<br />
Willy]]></description>
            <dc:creator>Willy Tarreau</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 08:10:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,109960#msg-109960</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,109960#msg-109960</link>
            <description><![CDATA[ sorry willy i sent this to wrong address. here is my other question:<br />
<br />
one more thing. is it possible for haproxy to failover to a backup,<br />
but not failback even if the server is alive again? for example, if i<br />
could set rise to be infinite so that once it was down, it was down<br />
for good? currently, i am handling this with a text file that gets<br />
written and once there forces my ruby db checker to return 5xx to<br />
haproxy. can you all think of any better way to deal with this withing<br />
haproxy?<br />
<br />
thanks...gg<br />
<br />
On Thu, Feb 25, 2010 at 9:07 PM, Greg Gard &lt;ggard@carepaths.com&gt; wrote:<br />
&gt; hi guys,<br />
&gt;<br />
&gt; thanks for the feedback. yet another rails issue that makes deployment<br />
&gt; a hassle. my biggest issue with setting the timeouts is that when a<br />
&gt; user hits the page after a timeout, they will get a 5xx error, but<br />
&gt; perhaps i can teach rails to catch the exception and retry the<br />
&gt; connection. anyway, thanks for clarifying that i wasn't missing some<br />
&gt; simple config option.<br />
&gt;<br />
&gt; ...gg<br />
&gt;<br />
&gt; On Thu, Feb 25, 2010 at 6:24 PM, Willy Tarreau &lt;w@1wt.eu&gt; wrote:<br />
&gt;&gt; Hi,<br />
&gt;&gt;<br />
&gt;&gt; On Thu, Feb 25, 2010 at 10:54:35PM +0100, XANi wrote:<br />
&gt;&gt;&gt; Dnia 2010-02-25, czw o godzinie 16:27 -0500, Greg Gard pisze:<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; &gt; hi willy and friends,<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt; &gt; i am working on a set of ruby scripts to do database failover and<br />
&gt;&gt;&gt; &gt; stonith. so far all is working pretty well, but i have a few issues:<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt; &gt; 1) rails makes persistent connections to the backend database so when<br />
&gt;&gt;&gt; &gt; a server is marked down, the connection remains ongoing. currently, i<br />
&gt;&gt;&gt; &gt; deal with this by issuing a &quot;stonith&quot; command in my ruby &quot;driver&quot;<br />
&gt;&gt;&gt; &gt; script for haproxy that shuts the backend down explicitly via ssh, but<br />
&gt;&gt;&gt; &gt; it would be nice if i could rely on haproxy to kill the connection<br />
&gt;&gt;&gt; &gt; explicitly. is there a setting to make haproxy kill existing<br />
&gt;&gt;&gt; &gt; connections on a backend going down?<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt; &gt; 2) for rails i have tcp timeout set to 0 so it seems to be handling<br />
&gt;&gt;&gt; &gt; the persistent connections ok, but when i do a reload using the<br />
&gt;&gt;&gt; &gt; haproxy init script in the debian packages, i end up with two haproxy<br />
&gt;&gt;&gt; &gt; backends as the persistent connections aren't killed. essentially the<br />
&gt;&gt;&gt; &gt; original process is waiting for the connections to end before it kills<br />
&gt;&gt;&gt; &gt; itself, but that will never happen with rails db connection. any ideas<br />
&gt;&gt;&gt; &gt; or suggestions?<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt; &gt; ps: having rails not use persistent connections is not really what i<br />
&gt;&gt;&gt; &gt; would like to do right now. i have run that in the past on production<br />
&gt;&gt;&gt; &gt; and had wierd timeout problems and choppy connectivity.<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt; &gt; thanks...gg<br />
&gt;&gt;&gt; &gt;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; 1) If i remember correctly client/server timeouts only trigger when<br />
&gt;&gt;&gt; there is no activity (no data send) so setting client and server timeout<br />
&gt;&gt;&gt; to like 5 min could solve problem<br />
&gt;&gt;&gt;     so as long as app do some queries connection won't be dropped<br />
&gt;&gt;<br />
&gt;&gt; Exactly. It is wrong to set infinite timeouts, it will always cause<br />
&gt;&gt; trouble. Still we see people using them from time to time, despite<br />
&gt;&gt; the huge annoying warning upon config reload.<br />
&gt;&gt;<br />
&gt;&gt;&gt; 2) u can do &quot;/etc/init.d/haproxy stop ; /etc/init.d/haproxy start&quot;<br />
&gt;&gt;<br />
&gt;&gt; The correct timeout will also take care of that because the connections<br />
&gt;&gt; will eventually die and the old process exit.<br />
&gt;&gt;<br />
&gt;&gt; This situation is the perfect illustration of why it's wrong to run<br />
&gt;&gt; with no timeouts.<br />
&gt;&gt;<br />
&gt;&gt; Regards,<br />
&gt;&gt; Willy<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; greg gard, psyd<br />
&gt; www.carepaths.com<br />
&gt;<br />
<br />
<br />
<br />
-- <br />
greg gard, psyd<br />
www.carepaths.com]]></description>
            <dc:creator>Greg Gard</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 04:10:02 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,109948#msg-109948</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,109948#msg-109948</link>
            <description><![CDATA[ hi guys,<br />
<br />
thanks for the feedback. yet another rails issue that makes deployment<br />
a hassle. my biggest issue with setting the timeouts is that when a<br />
user hits the page after a timeout, they will get a 5xx error, but<br />
perhaps i can teach rails to catch the exception and retry the<br />
connection. anyway, thanks for clarifying that i wasn't missing some<br />
simple config option.<br />
<br />
....gg<br />
<br />
On Thu, Feb 25, 2010 at 6:24 PM, Willy Tarreau &lt;w@1wt.eu&gt; wrote:<br />
&gt; Hi,<br />
&gt;<br />
&gt; On Thu, Feb 25, 2010 at 10:54:35PM +0100, XANi wrote:<br />
&gt;&gt; Dnia 2010-02-25, czw o godzinie 16:27 -0500, Greg Gard pisze:<br />
&gt;&gt;<br />
&gt;&gt; &gt; hi willy and friends,<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; i am working on a set of ruby scripts to do database failover and<br />
&gt;&gt; &gt; stonith. so far all is working pretty well, but i have a few issues:<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; 1) rails makes persistent connections to the backend database so when<br />
&gt;&gt; &gt; a server is marked down, the connection remains ongoing. currently, i<br />
&gt;&gt; &gt; deal with this by issuing a &quot;stonith&quot; command in my ruby &quot;driver&quot;<br />
&gt;&gt; &gt; script for haproxy that shuts the backend down explicitly via ssh, but<br />
&gt;&gt; &gt; it would be nice if i could rely on haproxy to kill the connection<br />
&gt;&gt; &gt; explicitly. is there a setting to make haproxy kill existing<br />
&gt;&gt; &gt; connections on a backend going down?<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; 2) for rails i have tcp timeout set to 0 so it seems to be handling<br />
&gt;&gt; &gt; the persistent connections ok, but when i do a reload using the<br />
&gt;&gt; &gt; haproxy init script in the debian packages, i end up with two haproxy<br />
&gt;&gt; &gt; backends as the persistent connections aren't killed. essentially the<br />
&gt;&gt; &gt; original process is waiting for the connections to end before it kills<br />
&gt;&gt; &gt; itself, but that will never happen with rails db connection. any ideas<br />
&gt;&gt; &gt; or suggestions?<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; ps: having rails not use persistent connections is not really what i<br />
&gt;&gt; &gt; would like to do right now. i have run that in the past on production<br />
&gt;&gt; &gt; and had wierd timeout problems and choppy connectivity.<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; thanks...gg<br />
&gt;&gt; &gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; 1) If i remember correctly client/server timeouts only trigger when<br />
&gt;&gt; there is no activity (no data send) so setting client and server timeout<br />
&gt;&gt; to like 5 min could solve problem<br />
&gt;&gt;     so as long as app do some queries connection won't be dropped<br />
&gt;<br />
&gt; Exactly. It is wrong to set infinite timeouts, it will always cause<br />
&gt; trouble. Still we see people using them from time to time, despite<br />
&gt; the huge annoying warning upon config reload.<br />
&gt;<br />
&gt;&gt; 2) u can do &quot;/etc/init.d/haproxy stop ; /etc/init.d/haproxy start&quot;<br />
&gt;<br />
&gt; The correct timeout will also take care of that because the connections<br />
&gt; will eventually die and the old process exit.<br />
&gt;<br />
&gt; This situation is the perfect illustration of why it's wrong to run<br />
&gt; with no timeouts.<br />
&gt;<br />
&gt; Regards,<br />
&gt; Willy<br />
&gt;<br />
&gt;<br />
<br />
<br />
<br />
-- <br />
greg gard, psyd<br />
www.carepaths.com]]></description>
            <dc:creator>Greg Gard</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 03:10:02 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,109886#msg-109886</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,109886#msg-109886</link>
            <description><![CDATA[ Hi,<br />
<br />
On Thu, Feb 25, 2010 at 10:54:35PM +0100, XANi wrote:<br />
&gt; Dnia 2010-02-25, czw o godzinie 16:27 -0500, Greg Gard pisze:<br />
&gt; <br />
&gt; &gt; hi willy and friends,<br />
&gt; &gt; <br />
&gt; &gt; i am working on a set of ruby scripts to do database failover and<br />
&gt; &gt; stonith. so far all is working pretty well, but i have a few issues:<br />
&gt; &gt; <br />
&gt; &gt; 1) rails makes persistent connections to the backend database so when<br />
&gt; &gt; a server is marked down, the connection remains ongoing. currently, i<br />
&gt; &gt; deal with this by issuing a &quot;stonith&quot; command in my ruby &quot;driver&quot;<br />
&gt; &gt; script for haproxy that shuts the backend down explicitly via ssh, but<br />
&gt; &gt; it would be nice if i could rely on haproxy to kill the connection<br />
&gt; &gt; explicitly. is there a setting to make haproxy kill existing<br />
&gt; &gt; connections on a backend going down?<br />
&gt; &gt; <br />
&gt; &gt; 2) for rails i have tcp timeout set to 0 so it seems to be handling<br />
&gt; &gt; the persistent connections ok, but when i do a reload using the<br />
&gt; &gt; haproxy init script in the debian packages, i end up with two haproxy<br />
&gt; &gt; backends as the persistent connections aren't killed. essentially the<br />
&gt; &gt; original process is waiting for the connections to end before it kills<br />
&gt; &gt; itself, but that will never happen with rails db connection. any ideas<br />
&gt; &gt; or suggestions?<br />
&gt; &gt; <br />
&gt; &gt; ps: having rails not use persistent connections is not really what i<br />
&gt; &gt; would like to do right now. i have run that in the past on production<br />
&gt; &gt; and had wierd timeout problems and choppy connectivity.<br />
&gt; &gt; <br />
&gt; &gt; thanks...gg<br />
&gt; &gt; <br />
&gt; <br />
&gt; <br />
&gt; 1) If i remember correctly client/server timeouts only trigger when<br />
&gt; there is no activity (no data send) so setting client and server timeout<br />
&gt; to like 5 min could solve problem<br />
&gt;     so as long as app do some queries connection won't be dropped<br />
<br />
Exactly. It is wrong to set infinite timeouts, it will always cause<br />
trouble. Still we see people using them from time to time, despite<br />
the huge annoying warning upon config reload.<br />
<br />
&gt; 2) u can do &quot;/etc/init.d/haproxy stop ; /etc/init.d/haproxy start&quot;<br />
<br />
The correct timeout will also take care of that because the connections<br />
will eventually die and the old process exit.<br />
<br />
This situation is the perfect illustration of why it's wrong to run<br />
with no timeouts.<br />
<br />
Regards,<br />
Willy]]></description>
            <dc:creator>Willy Tarreau</dc:creator>
            <category>HAProxy</category>
            <pubDate>Fri, 26 Feb 2010 00:30:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,109832#msg-109832</guid>
            <title>Re: killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,109832#msg-109832</link>
            <description><![CDATA[ Dnia 2010-02-25, czw o godzinie 16:27 -0500, Greg Gard pisze:<br />
<br />
&gt; hi willy and friends,<br />
&gt; <br />
&gt; i am working on a set of ruby scripts to do database failover and<br />
&gt; stonith. so far all is working pretty well, but i have a few issues:<br />
&gt; <br />
&gt; 1) rails makes persistent connections to the backend database so when<br />
&gt; a server is marked down, the connection remains ongoing. currently, i<br />
&gt; deal with this by issuing a &quot;stonith&quot; command in my ruby &quot;driver&quot;<br />
&gt; script for haproxy that shuts the backend down explicitly via ssh, but<br />
&gt; it would be nice if i could rely on haproxy to kill the connection<br />
&gt; explicitly. is there a setting to make haproxy kill existing<br />
&gt; connections on a backend going down?<br />
&gt; <br />
&gt; 2) for rails i have tcp timeout set to 0 so it seems to be handling<br />
&gt; the persistent connections ok, but when i do a reload using the<br />
&gt; haproxy init script in the debian packages, i end up with two haproxy<br />
&gt; backends as the persistent connections aren't killed. essentially the<br />
&gt; original process is waiting for the connections to end before it kills<br />
&gt; itself, but that will never happen with rails db connection. any ideas<br />
&gt; or suggestions?<br />
&gt; <br />
&gt; ps: having rails not use persistent connections is not really what i<br />
&gt; would like to do right now. i have run that in the past on production<br />
&gt; and had wierd timeout problems and choppy connectivity.<br />
&gt; <br />
&gt; thanks...gg<br />
&gt; <br />
<br />
<br />
1) If i remember correctly client/server timeouts only trigger when<br />
there is no activity (no data send) so setting client and server timeout<br />
to like 5 min could solve problem<br />
    so as long as app do some queries connection won't be dropped<br />
2) u can do &quot;/etc/init.d/haproxy stop ; /etc/init.d/haproxy start&quot;<br />
-- <br />
Mariusz Gronczewski (XANi) &lt;xani666@gmail.com&gt;<br />
GnuPG: 0xEA8ACE64<br />
<a href="http://devrandom.pl" target="_blank"  rel="nofollow">http://devrandom.pl</a>]]></description>
            <dc:creator>XANi</dc:creator>
            <category>HAProxy</category>
            <pubDate>Thu, 25 Feb 2010 23:00:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?10,109807,109807#msg-109807</guid>
            <title>killing persisent conections on backends marked down?</title>
            <link>http://www.serverphorums.com/read.php?10,109807,109807#msg-109807</link>
            <description><![CDATA[ hi willy and friends,<br />
<br />
i am working on a set of ruby scripts to do database failover and<br />
stonith. so far all is working pretty well, but i have a few issues:<br />
<br />
1) rails makes persistent connections to the backend database so when<br />
a server is marked down, the connection remains ongoing. currently, i<br />
deal with this by issuing a &quot;stonith&quot; command in my ruby &quot;driver&quot;<br />
script for haproxy that shuts the backend down explicitly via ssh, but<br />
it would be nice if i could rely on haproxy to kill the connection<br />
explicitly. is there a setting to make haproxy kill existing<br />
connections on a backend going down?<br />
<br />
2) for rails i have tcp timeout set to 0 so it seems to be handling<br />
the persistent connections ok, but when i do a reload using the<br />
haproxy init script in the debian packages, i end up with two haproxy<br />
backends as the persistent connections aren't killed. essentially the<br />
original process is waiting for the connections to end before it kills<br />
itself, but that will never happen with rails db connection. any ideas<br />
or suggestions?<br />
<br />
ps: having rails not use persistent connections is not really what i<br />
would like to do right now. i have run that in the past on production<br />
and had wierd timeout problems and choppy connectivity.<br />
<br />
thanks...gg<br />
<br />
-- <br />
greg gard, psyd<br />
www.carepaths.com]]></description>
            <dc:creator>Greg Gard</dc:creator>
            <category>HAProxy</category>
            <pubDate>Thu, 25 Feb 2010 22:40:01 +0100</pubDate>
        </item>
    </channel>
</rss>
