Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

When does hikari change query timeout to validation timeout?


Asked by Kyson Potts on Dec 13, 2021 FAQ



It looks like Hikari uses query timeout if isNetworkTimeoutSupported = false, but it doesn't set it back to the original one. As result clients gets connection with query timeout set to validation timeout instead of default one. @mi-st That would be a bug in the H2 driver, I recommend reporting it to them, they are fairly responsive.
Thereof,
A connection timeout is a contract between application and the pool; your application should get a connection within the specified time or get an exception. In the end, HikariCP throws connection not available if it times out. Behaviour when the connection pool is exhausted:
Furthermore, ValidationTimeout is used to specify the timeout period ( The default is 5 seconds, and the minimum cannot be less than 250 milliseconds. ), if connectionTestQuery is not set, the connection. isValid (Validation Seconds) in jdbc4 specification is used by default to verify the validity of the connection.
Besides,
HikariCP will log an error if your driver is not JDBC4 compliant to let you know. Letting Hikari use the Connection.isValid method should be more efficient than executing a query. HikariCP tries to strike a balance between performance and reliability.
Likewise,
If we are using Spring Boot 2.0 and onwards, Spring Boot selects HikariDataSource by default and we need not to configure above line. Now to configure Hikari specific connection pool settings, Spring Boot provides spring.datasource.hikari.* prefix to be used in application.properties file. We will discuss here some frequently used configurations.