connection performance

12 views
Skip to first unread message

Hugo Larson

unread,
Nov 21, 2022, 1:52:37 PM11/21/22
to Firebird-java
Hello,

How "expensive" is it to open and close Jaybird connection every time a query is executed?
Localhost and non localhost.
Does the underlaying socket and network layer has any "keep-alive" mechanism?
Windows and Linux OS.

What is your opinion?

Thank you and regards.
Hugo. 

amolna...@gmail.com

unread,
Nov 22, 2022, 3:09:49 AM11/22/22
to firebird-java
Hi Hugo!

It's expensivem that'y why connection pool design exists.
There are no keep alive features in the drivers and clienst. The Apache BasicDataSource pool has such feature.

Mark Rotteveel

unread,
Nov 22, 2022, 4:13:25 AM11/22/22
to firebi...@googlegroups.com
On 21-11-2022 19:52, 'Hugo Larson' via firebird-java wrote:
> How "expensive" is it to open and close Jaybird connection every time a
> query is executed?
> Localhost and non localhost.
> Does the underlaying socket and network layer has any "keep-alive"
> mechanism?
> Windows and Linux OS.
>
> What is your opinion?

When you create a new physical connection with Jaybird to Firebird 3.0
or higher, it requires at least three network roundtrips (not including
the TCP handshake) to establish a connection with wire encryption. More
if multiple authentication plugins need to be tried, or if database
encryption is used.

That is relatively expensive, so if you want to create and close a
connection for every database query your perform, I highly recommend you
use a connection pool like HikariCP, c3p0, or Apache DBCP.

A connection pool holds a collection of physical connections, and when
you ask for a connection, it returns you a logical connection (a wrapper
around a physical connection) from the pool. If you close that logical
connection, it will behave as a closed connection, but the physical
connection is returned to the pool for reuse.

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Nov 22, 2022, 3:03:54 PM11/22/22
to firebi...@googlegroups.com
Thanks Mark.

--
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-java+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages