Re: Patch to add a socketTimeout property.

From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-11 17:02:53
Message-ID: 65D7DC3D-F175-4E8D-8383-0B0086DDFCB4@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I agree completely that keepalive is the more correct solution but
that the ability to set the timeout to something reasonable is a plus
for sotimeout.
That said, I'll take a shot at listing a few pros and cons for
allowing access to either.

Cons:
1. It could be confusing to a developer when the connection if a
connection is dropped (especially when doing a long running query).
2. I'm assuming (and please correct me if not) that postgresql will
continue to run a long query until trying to access the socket again.
If true, code could be written where it leads to a user submitting the
same long running queries to the database thinking there is just a
transient problem.

Pros:
1. Either or both are useful in unusual/unreliable networking
situations.
2. With correct settings and infrastructure, allowing the socket close
itself, can keep a connection pool from filling and threads from
hanging.
3. Setting sotimeout is available in some other major drivers (Oracle
odbc5, IBM db2jcc and jdts).

Art Gramlich
Chief Application Architect
HealthTrio, LLC
art(dot)gramlich(at)healthtrio(dot)com

On Apr 10, 2008, at 5:51 PM, Kris Jurka wrote:

>
>
> On Thu, 10 Apr 2008, Art Gramlich wrote:
>
>> They do. We usually have different connection pools for normal
>> (short running) and long queries. Since almost all are short
>> running, this has worked well for us. I actually haven't tried
>> setting keepalive in this situation. so I can't say much, but the
>> vpn solutions we have used have at times gotten into some pretty
>> wierd states and sotimeouts could stop our pools from going crazy.
>>
>
> I can see how keepalives are generally useful while sotimeouts are
> only useful in the specific situation where you can set a global
> limit on your query times. On the other hand the sotimeout is
> configurable while the keepalive timeout isn't configurable (at
> least in Java). I'm not particularly excited about either option,
> but I don't need them either.
> I don't see a danger with exposing them as options as long as the
> pros and cons are clearly explained.
>
> Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Toru SHIMOGAKI 2008-04-12 00:27:07 Re: Patch to add a socketTimeout property.
Previous Message Kris Jurka 2008-04-11 00:51:44 Re: Patch to add a socketTimeout property.