eclipse-vertx / vertx-sql-client

High performance reactive SQL Client written in Java
Apache License 2.0
894 stars 200 forks source link

Oracle: Lightweight Connection Validation #1451

Closed tsegismont closed 3 months ago

tsegismont commented 3 months ago

See #1450

tsegismont commented 3 months ago

Hi @loiclefevre , I would appreciate your advice on this. Is the SOCKET connection validation level appropriate (non-blocking)? Or should we consider something lower, like INBAND_DOWN or LOCAL?

cc @DavideD

gvenzl commented 3 months ago

Hey @tsegismont,

@loiclefevre is on his well-deserved holiday, hence I'm adding @jeandelavarene to this thread to provide guidance on your question about OracleConnection.ConnectionValidation. and which mode to use.

Meanwhile, according to the JavaDoc it would seems indeed that SOCKET does not involve a network call but just checks whether the socket is still alive.

jeandelavarene commented 3 months ago

Here is a description of the different validation modes in decreasing order of validation strength:

Note that, for example, a "SOCKET" validation may return a false positive (it may not always detect all socket defects). On the other hand, a "SOCKET" validation is much faster than "NETWORK". In most cases, we recommend using "SOCKET" validation at connection borrow (in UCP for example). For applications that can't tolerate an error on the connection, turning on "SERVER" or "NETWORK" would be more appropriate.

CC @gvenzl

tsegismont commented 3 months ago

Thank you @gvenzl and @jeandelavarene

In this part of our code we can't tolerate the driver to block (event not every time). And for the other clients (Pg, MySQL, ...etc) where Vert.x manages the connection, we only check the connection's lifecycle (variable check):

https://github.com/eclipse-vertx/vertx-sql-client/blob/ccc784a3a2b1e3f8790fb2781f14404fa83886ea/vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/SocketConnectionBase.java#L160

So I think the appropriate setting is NONE in our case. This will provide the same experience as with other clients.