Re: proposal: setKeepAlive

From: "Toru SHIMOGAKI" <shimogaki(dot)toru(at)gmail(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Cc: "oru SHIMOGAKI" <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
Subject: Re: proposal: setKeepAlive
Date: 2008-02-11 11:05:19
Message-ID: e43b8e4f0802110305j169efd9av34e7df184cc7f395@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The attached is the second version of setKeepAlive patch, which enables
that user can turn the configuration flag on/off. The default is off.

2008/2/10, Oliver Jowett <oliver(at)opencloud(dot)com>:

> I agree that aggressive keepalives are not particularly useful in that case.

I agree the above too, and I don't think TCP keepalive is a perfect
solution. As Gregory already said, to provide a detailed
application-specific monitoring, some kind of application level test
(maybe using setQueryTimeout()) is still needed.

But nonetheless I think some of the cases are solved by this simple
keepalive.

For instance, resource collection without server rebooting on an
application server side, which is occupied by lost connections:

1. There are master-slave database servers connecting to a shared disk,
and application servers connect the master server first.
2. If the master database server gets down and fails over to the slave
server by a high-availability clustering suite, then connections from
the application servers to the master server are remained and not to be
collected, because JDBC driver doesn't send any exceptions in this case,
so application can't take measures to solve it.
3. If hundreds / thousands of connections are remained, a large quantity
of resources used by the lost connections die in vain and should be
removed without application server rebooting sooner or later.

I do hope all the dead server detection is implemented. I'd like to
avoid JDBC driver doesn't say anything in this case now. It seems to
me implementing setQueryTimeout() is so easy as doing setKeepAlive().
I think this patch just provides the least-level assuarance.

Best regards,

Attachment Content-Type Size
setKeepAlive_v2.patch text/x-patch 4.6 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jan de Visser 2008-02-12 01:04:36 Re: Patch for Statement.getGeneratedKeys()
Previous Message andreasfreyer 2008-02-11 08:09:25 Re: getXXX throws SQLException while on insert row