https://bz.apache.org/bugzilla/show_bug.cgi?id=63406
Bug ID: 63406
Summary: new option for JDBC connection configuration:
pre-initialize the connection pool
Product: JMeter
Version: 5.1.1
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Main
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: JMETER_5.1.1
Hello JMeter developers,
I would like to suggest an enhancement to the JDBC connection configuration:
An option (true/false) where you can choose to pre-initialize the JDBC
connection pool.
The default option should be "false", in order to not break existing behavior.
Currently, you get longer execution times for the first JDBC request for each
thread of a thread group,
because the JDBC pool is only initialized when the first JDBC request asks the
JDBC connection pool for a connection to execute its sql query.
Initialization currently also means: initializing the whole pool - before any
JDBC request sampler is given a connection.
That means that each JDBC request, that is started before the connection pool
is fully initialized, is affected by measuring connection establishment times
for each of the following KPIs:
Elapsed time, latency, connect time.
There would also be an argument for setting the default option to be "true" and
break existing behavior - as it doesn't make sense to measure "connect time"
for example:
Because "connect time" for the first query doesn't mean "connection
establishment time for one connection" - it currently means "connection
establishment time for the whole pool".
The bigger the pool, the bigger the effect.
I know there are workarounds for this (e.g. a setup thread group). But then you
have the sampler times even of that setup thread group in your result.jtl file.
I know there is an option to use a JSR223 post processor, sending some Groovy
code like "prev.setIgnore()". But this is not very user friendly.
Here is what I found regarding the connection pooling library:
https://commons.apache.org/proper/commons-dbcp/apidocs/org/apache/commons/dbcp2/BasicDataSource.html#setInitialSize-int-
it says: "The pool is initialized the first time one of the following methods
is invoked: getConnection, setLogwriter, setLoginTimeout, getLoginTimeout,
getLogWriter."
https://commons.apache.org/proper/commons-dbcp/apidocs/org/apache/commons/dbcp2/BasicDataSource.html#getLogWriter--
it says: "Calls createDataSource(), so has the side effect of initializing the
connection pool."
Using the side effect in our favour, here is my suggested change (currently
hardcoded) - I need to add in in the GUI as an option of course - before asking
for a git pull request:
https://github.com/frschwab/jmeter/commit/8dd8462f9349b990640f3e2290c84f23a715a7c5
Thanks for any feedback on this.
Best regards,
Franz
--
You are receiving this mail because:
You are the assignee for the bug.