Re: Keep-alive support

From: Leandro Lucarella <llucarella(at)integratech(dot)com(dot)ar>
To: Leandro Lucarella <llucarella(at)integratech(dot)com(dot)ar>
Cc: pgsql-interfaces(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Keep-alive support
Date: 2006-12-01 15:44:22
Message-ID: 45704DD6.1040201@integratech.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

For pgsql-hackers, here is the original thread (I think this mail is
appropriate for this list, correct me if I'm wrong):
http://archives.postgresql.org/pgsql-interfaces/2006-11/msg00014.php

Leandro Lucarella escribió:
> Thanks all for your responses, but this is *not* a libpqxx issue, just
> because I'm doing the test using plain libpq. Anyways, I have a little
> more information about my problem and it's no libpq either =)
>
> The problem is shown when the time between the wire is unplugged and the
> use of the connection is not long enough to let the keep-alive kill the
> connection. Then the connection becomes active and the TCP timers looks
> like go back to the defaults, because there is data in the socket queue
> to send. So it's an OS/TCP issue.
>
> I don't see any way to control this without using an application-level
> keep-alive, so I appreciate any ideas and suggestions =)

Hi! It's me again =)

I was thinking about solutions for my problem, and I've come up with
(mainly) this 3 ideas:

1) Add TIPC[1] support to Postgresql. This is the cleaner solution, I
think, but the the hardest and could take a lot of time, but if I use
some of the other hacks in the meantime and if there is interest on
adding this to Postgresql officially, I can evaluate working on this
seriously. What I'm sure I don't want is to keep my own Postresql fork.
So, what do you think about this? Or where should I ask?

2) Use a "monitor" dummy connection to postgres, do the TCP keep-alive
tunning and select() the socket waiting for a disconnection. Since this
socket will never be active (is that right? Or Postgresql sends any kind
of control information on an idle connection?), the TCP keep-alive will
be enough to determine if the connection is lost in a short period of
time. If there is no problem with this, I think it could be a quick and
not-so-nasty solution =)

3) Use Heartbeat[2] or make some other specific solution like it
(probably using TIPC too). I don't like it at all, since I'm looking for
a more self-contained solution, but it's another option.

I really appreciate any thought on this, and any suggestions.

TIA.

[1] http://tipc.sourceforge.net/
[2] http://www.linux-ha.org/HeartbeatProgram

--
Leandro Lucarella
Integratech S.A.
4571-5252

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas ADI SD 2006-12-01 15:45:00 Re: FOR SHARE vs FOR UPDATE locks
Previous Message Tom Lane 2006-12-01 15:37:07 Re: small pg_dump RFE: new --no-prompt (password) option

Browse pgsql-interfaces by date

  From Date Subject
Next Message Kevin Fallis 2006-12-01 18:04:06 query optimization on prepared statement through connection vi libpq
Previous Message Leandro Lucarella 2006-11-30 14:11:08 Re: Keep-alive support