Обсуждение: Speed up JDBC connection creation on 9.0+

Поиск
Список
Период
Сортировка

Speed up JDBC connection creation on 9.0+

От
Sehrope Sarkuni
Дата:
I submitted a pull request[1] that speeds up connection creation when
connection to a 9.0+ database. The idea is that if you instruct the
driver in advance that the remote server is 9.0+ then it can send the
"application_data" and "extra_float_digits" parameters as part of the
StartupMessage rather than in separate "SET ..." statements
afterwards. This saves a couple of round trips when creating a new
JDBC connection.

It probably won't make much difference for most people as if you're
using a connection pool the startup cost only happens once but it does
help a little bit.

For lack of a better name I've called the new boolean connection
property "isModernServer". Feel free to suggest a better name.

Thinking about it a bit more, if 8.4 is going to be EOL this year then
would it make more sense to skip this idea and just wait till it's
gone?

At that point we could have newer versions the JDBC driver (say a 9.4
release) assume the remote server is 9.0+ and not even bother with the
additional connection property.

We could even do the reverse and have a property instruct the driver
that the server is <9.0 so it doesn't send the application_name
property in the StartupMessage. Anyone upgrading to the latest driver
but using an older (EOLed) database would have to add the extra
property for compatibility but everybody else using 9.0+ servers would
get the faster startup without any config changes.

If that's acceptable then I think it's a better approach.

[1]: https://github.com/pgjdbc/pgjdbc/pull/144

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | http://www.jackdb.com/


Re: Speed up JDBC connection creation on 9.0+

От
Gavin Flower
Дата:
On 19/04/14 11:28, Sehrope Sarkuni wrote:
> I submitted a pull request[1] that speeds up connection creation when
> connection to a 9.0+ database. The idea is that if you instruct the
> driver in advance that the remote server is 9.0+ then it can send the
> "application_data" and "extra_float_digits" parameters as part of the
> StartupMessage rather than in separate "SET ..." statements
> afterwards. This saves a couple of round trips when creating a new
> JDBC connection.
>
> It probably won't make much difference for most people as if you're
> using a connection pool the startup cost only happens once but it does
> help a little bit.
>
> For lack of a better name I've called the new boolean connection
> property "isModernServer". Feel free to suggest a better name.
>
> Thinking about it a bit more, if 8.4 is going to be EOL this year then
> would it make more sense to skip this idea and just wait till it's
> gone?
>
> At that point we could have newer versions the JDBC driver (say a 9.4
> release) assume the remote server is 9.0+ and not even bother with the
> additional connection property.
>
> We could even do the reverse and have a property instruct the driver
> that the server is <9.0 so it doesn't send the application_name
> property in the StartupMessage. Anyone upgrading to the latest driver
> but using an older (EOLed) database would have to add the extra
> property for compatibility but everybody else using 9.0+ servers would
> get the faster startup without any config changes.
>
> If that's acceptable then I think it's a better approach.
>
> [1]: https://github.com/pgjdbc/pgjdbc/pull/144
>
> Regards,
> -- Sehrope Sarkuni
> Founder & CEO | JackDB, Inc. | http://www.jackdb.com/
>
>
What happens when we get an even more Modern Server?

How about 'is9.0PlusServer', or something like it?


Cheers,
Gavin


Re: Speed up JDBC connection creation on 9.0+

От
Sehrope Sarkuni
Дата:
On Fri, Apr 18, 2014 at 7:56 PM, Gavin Flower
<GavinFlower@archidevsys.co.nz> wrote:
> What happens when we get an even more Modern Server?

Well we could use "isModernerServer" and "isModernestServer" each at
least once ...

> How about 'is9.0PlusServer', or something like it?

Yes something like that would be better.

Alternatively how about specifying the minimum expected server version
(say "minServerVersion")? That should be fairly future proof.  The
driver could even throw an exception if the server version isn't
compatible when it receives the "server_version" ParameterStatus on
init.

What do you guys think of not doing anything now and instead having
this behavior be the default in the next version of the driver?

As much as I like having a connection property to set now, I'd much
prefer to just get this "for free" by upgrading to a newer driver
without changing JDBC urls. If everybody will be assumed to be running
9.0+ (after 8.4 is EOL) then it's a bit annoying to have to add the
connection property everywhere to get this.

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | http://www.jackdb.com/


Re: Speed up JDBC connection creation on 9.0+

От
Gavin Flower
Дата:
On 19/04/14 12:18, Sehrope Sarkuni wrote:
> On Fri, Apr 18, 2014 at 7:56 PM, Gavin Flower
> <GavinFlower@archidevsys.co.nz> wrote:
>> What happens when we get an even more Modern Server?
> Well we could use "isModernerServer" and "isModernestServer" each at
> least once ...
>
[...]

Sounds like the start of a Monty Python comedy sketch...  :-)


Cheers,
Gavin