hikaricp - Behaviour of Hikari setConnectionTimeout -



hikaricp - Behaviour of Hikari setConnectionTimeout -

just looking explanation of rationale bit of code (poolutiltites:293 in version 2.2.4):

datasource.setlogintimeout((int) timeunit.milliseconds.toseconds(math.min(1000l, connectiontimeout)));

this code , setconnectiontimeout method means behaviour:

connectiontimeout == 0, logintimeout = integer.max_value connectiontimeout > 0 && < 100, hikariconfig throws illegalargumentexception connectiontimeout >= 100 && <= 1000, logintimeout = connectiontimeout connectionteimout > 1000, logintimeout = 1000

that looks weird me!

it's math.min should math.max ???

in current project i'd fail connections after 30s, impossible in current setup.

i'm using 4.1 postgres jdbc driver, think not relevant issue above.

many - , cool pooling library!!!

ok, there couple of moving parts here. first, math.min() bug, should math.max(). in lite of (it fixed) consider following:

it of import note connections created asynchronously in pool. setconnectiontimeout() sets maximum time (in milliseconds) phone call getconnection() wait connection before timing out.

the datasource logintimeout maximum time physical connection initiation database can take before timing out. because hikaricp obtains connections asynchronously, if connection effort fails, hikaricp go on retry, calls getconnection() timeout appropriately. using connectiontimeout in kind of double duty logintimeout.

for example, lets pool empty, , have configured connectiontimeout of 30 seconds. when phone call getconnection() hikaricp, realizing there no idle connections available, starts trying obtain new one. there little point in having logintimeout exceeding 30 seconds, in case.

the intent of math.max() phone call ensure never set logintimeout 0 if user has configured connectiontimeout 250ms. timeunit.milleseconds.toseconds() homecoming 0 without math.max(). if user has configured connectiontimeout of 0, meaning never want timeout, time conversion of integer.max_value results in several one thousand years timeout (virtually never).

having said that, , in lite of how hikaricp connections database obtained asynchronously, without math.max() fix, should able accomplish application-level connection timeouts of 30s. unless physical connections database exceed 1000ms unaffected math.min().

we putting out 2.2.5-rc3 release candidate in next few hours. slot prepare in.

hikaricp

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -