From: | Andrew Chernow <ac(at)esilo(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | daveg <daveg(at)sonic(dot)net>, Tollef Fog Heen <tollef(dot)fog(dot)heen(at)collabora(dot)co(dot)uk>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: TCP keepalive support for libpq |
Date: | 2010-02-11 13:44:18 |
Message-ID: | 4B7409B2.9010007@esilo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>> ISTM that the default behavior should be keep alives disabled, as it is
>>> now, and those wanting it can just set it in their apps:
>>>
>>> setsockopt(PQsocket(conn), SOL_SOCKET, SO_KEEPALIVE, ...)
>> I disagree. I have clients who have problems with leftover client connections
>> due to server host failures. They do not write apps in C. For a non-default
>> change to be effective we would need to have all the client drivers, eg JDBC,
>> psycopg, DBD-DBI, and the apps like psql make changes to turn it on. Adding
>> this option as a non-default will not really help.
>
> Yes, that's definitely the use-case. PQsocket() will work fine for C apps only.
>
> But it should work fine as an option, no? As long as you can specify
> it on the connection string - I don't think there are any interfaces
> that won't take a connection string?
>
Perl and python appear to have the same abilities as C. I don't use either of
these drivers but I *think* the below would work:
DBD:DBI
setsockopt($dbh->pg_socket(), ...);
psycopg
conn.cursor().socket().setsockopt(...);
Although, I think Dave's comments have made me change my mind about this patch.
Looks like it serves a good purpose. That said, there is no guarentee the
driver will implement the new feature ... JDBC seems to lack the ability to get
the backing Socket object but java can set socket options. Maybe a JDBC kong fu
master knows how to do this.
--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Marko Tiikkaja | 2010-02-11 13:46:45 | Re: Writeable CTEs and empty relations |
Previous Message | Dimitri Fontaine | 2010-02-11 13:41:15 | Re: Re: [COMMITTERS] pgsql: Make standby server continuously retry restoring the next WAL |