pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vitalii Tymchyshyn <tivv00@gmail.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: PG-JDBC Mailing List <pgsql-jdbc@postgresql.org>
Subject: Re: NIO support
Date: Fri, 20 Jan 2012 15:54:23 +0200
Message-ID: <4F19720F.6010008@gmail.com> (raw)
In-Reply-To: <CADK3HHJ8krgeELCLq7bf9Wqq-GOAeoL3OYYyF_c_kZPgNs1zGw@mail.gmail.com>
References: <CABWW-d1hujwUtT+CEF6mWNf9gDddo-7gXRVoB+iaaE1Su1KNbw@mail.gmail.com>
	<CADK3HHJ8krgeELCLq7bf9Wqq-GOAeoL3OYYyF_c_kZPgNs1zGw@mail.gmail.com>

Hello.

This patch provides timeouts without additional threads.
I am going to enhance it to additionally solve next problems (as for me 
this problem are easily solvable with NIO):
1) DeadLock when client and server send buffers fill up. This is rare 
case because it requires query to start generation output (e.g. notices) 
before all query data is sent to server. AFAIR this can be provoked by 
copying to table with trigger outputting notices.
2) When SSL is enabled, getNotifications does not return notifications 
until server is asked for anything.

Also move to NIO may produce better performance, but this is still 
something to be checked. It may be needed to select carefully if Heap or 
Off-heap buffers should be used to get performance benefit.

P.S. Unrelated to NIO, current setQueryTimeout code has bug since it 
treats timeout as being specified in milliseconds, while javadoc says 
it's in seconds.

20.01.12 14:05, Dave Cramer написав(ла):
> Can you confirm that this patch is just to add time out ?
>
> If not can you outline what problem you are trying to solve ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
>
> 2012/1/19 Віталій Тимчишин<tivv00@gmail.com>:
>> OK, I finally have first try of NIO support in the patch attached.
>> The only current feature is query timeout without any additional threads.
>> Please note that current driver has a bug: JDBC specs says timeout is in
>> seconds and driver takes it as millis, fixed in my patch.
>> Also current query timeout schema limitation is that query timeout
>> processing still requires server round trips that are not under timeout
>> control. I really don't see how much this differ from simply setting
>> server-side timeout for fast connections. For slow connections it's still
>> unreliable. Good thing that it is may be possible to enforce some kind of
>> hard timeout with NIO schema as it's easy to control blocking calls.
>> Limitations: only for V3 non-secure connections. Other connections use
>> regular stream-based implementation.
>> Planned features:
>>   * SSL with NIO. This should allow to receive notifications without server
>> roundtrip in SSL mode
>>   * Read answer while sending query. This should make go away the problem
>> when large query is blocked because answer must be read to send more data to
>> server.
>>
>> Note that I have never worked with CVS and have problems to make patch with
>> new files (AFAICS I can't add it to CVS with RO access).
>> Comments are welcome.
>> P.S. To work with SSL I need to start SSL tests. Any hints?
>>
>> --
>> Best regards,
>>   Vitalii Tymchyshyn
>>
>>
>> --
>> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc
>>




view thread (10+ messages)  latest in thread

Message-ID: <4F19720F.6010008@gmail.com>
Permalink:  ../4F19720F.6010008@gmail.com/
Also on:    postgresql.org/message-id/4F19720F.6010008@gmail.com

 · 

reply

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: tivv00@gmail.com, pg@fastcrypt.com
  Subject: Re: NIO support
  In-Reply-To: <4F19720F.6010008@gmail.com>
  References: <CABWW-d1hujwUtT+CEF6mWNf9gDddo-7gXRVoB+iaaE1Su1KNbw@mail.gmail.com> <CADK3HHJ8krgeELCLq7bf9Wqq-GOAeoL3OYYyF_c_kZPgNs1zGw@mail.gmail.com> <4F19720F.6010008@gmail.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