From: Oliver Jowett <oliver@opencloud.com>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: proposal: setKeepAlive
Date: Sun, 10 Feb 2008 11:45:27 +1300
Message-ID: <47AE2D07.50904@opencloud.com> (raw)
In-Reply-To: <87abmb2weo.fsf@oxford.xeocode.com>
References: <47AC666C.9070704@oss.ntt.co.jp>
<87abmb2weo.fsf@oxford.xeocode.com>
Gregory Stark wrote:
> TCP is supposed to work even if the network disappears and then reappears
> later, gracefully handling intermittent network failures. The case where you
> want to close connections which doesn't respond quickly is when you have hosts
> (usually clients, which makes it strange to want this in a database client
> driver) which are frequently permanently unplugged or renumbered such as
> dialup users. That's why it's important for ftp servers or web servers.
People seem to like to put stateful firewalls with low connection
activity timeouts between their DB server and client. We get regular
traffic on the list from people who see connections get reset on their
first use after a long idle period. Presumably TCP keepalive would help
in some of these cases.
Also, usually DB connections are local and you don't really want to
plaster over the fact that the other end has gone MIA. Between default
TCP retransmission times and default TCP keepalive settings and the lack
of a uniform setQueryTimeout() within the driver, it's actually really
hard to work out promptly that the DB server is dead which is a royal
pain if you are trying to do failover between servers. Keepalive helps a
little but it's certainly not perfect. I ended up doing all the dead
server detection at a higher level in the end.
> "Kris Jurka" <books@ejurka.com> writes:
>
>> > Java does not support a configurable keepalive interval, it's simply an on/off
>> > flag.
>
> Uhm, well that kind of sucks, though to be honest I suspect most people who
> override the OS default set it to inappropriately short intervals anyways.
The lack of support in Java is why when I did the server-side work to
support configurable TCP keepalive I didn't do the Java side too - the
default OS timeouts are way too large for the case I cared about. Also,
the Java side doesn't sit around waiting on read, so it won't actually
notice the connection is dead until the next time it tries to use it
anyway, at which point you might as well just poll the server with a
dummy query every X seconds.
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, stark@enterprisedb.com, shimogaki.toru@oss.ntt.co.jp
Subject: Re: proposal: setKeepAlive
In-Reply-To: <47AE2D07.50904@opencloud.com>
References: <47AC666C.9070704@oss.ntt.co.jp> <87abmb2weo.fsf@oxford.xeocode.com> <47AE2D07.50904@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox