You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Felix Schumacher <fe...@internetallee.de> on 2021/08/17 09:05:42 UTC

Re: Have JMeter Prepare SQL ONLY once and Execute Multiple times

Am 27.07.21 um 20:25 schrieb Jeff Lutzow:
> Is there a way to accomplish the above?    Everything I have tried I still see JMeter “Prepare” the SQL statement every time when using the JDBC driver to connect to IBM Data Virtualization Manager.
>
> I would like to run a test where it runs the same request multiple times but ONLY Prepares the request one time.

How do you test, that the statements are prepared every time?

What is the setup of your pool definition (in the JDBC Connection)?

Do you want to share the connections over all the threads? (This is not
the default in JMeter. Every thread/user has its own connection unless
configured otherwise)

Felix


>
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
>
> ================================
> Rocket Software, Inc. and subsidiaries ¦ 77 Fourth Avenue, Waltham MA 02451 ¦ Main Office Toll Free Number: +1 855.577.4323
> Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
> Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
> Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
> ================================
>
> This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.
>


Re: Sharing the JDBC Connection between all the threads

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 17.08.21 um 21:15 schrieb Tong Sun:
> On Tue, Aug 17, 2021 at 5:06 AM Felix Schumacher <
> felix.schumacher@internetallee.de> wrote:
>
>> Do you want to share the connections over all the threads? (This is not
>> the default in JMeter. Every thread/user has its own connection unless
>> configured otherwise)
>>
>  Hi, Felix
>
> Can you elaborate on how to share a single JDBC Connection between all the
> threads pls?
>
> All the threads can share a single CSV input but for them to share a single
> JDBC Connection I'm yet to find how.
>
> It'll help to send unique values in the requests from all the threads.

To configure this, use "1" as "Max Number of Connections".

Felix

>
> thanks
>


Sharing the JDBC Connection between all the threads

Posted by Tong Sun <su...@gmail.com>.
On Tue, Aug 17, 2021 at 5:06 AM Felix Schumacher <
felix.schumacher@internetallee.de> wrote:

>
> Do you want to share the connections over all the threads? (This is not
> the default in JMeter. Every thread/user has its own connection unless
> configured otherwise)
>

 Hi, Felix

Can you elaborate on how to share a single JDBC Connection between all the
threads pls?

All the threads can share a single CSV input but for them to share a single
JDBC Connection I'm yet to find how.

It'll help to send unique values in the requests from all the threads.

thanks

Re: FW: Have JMeter Prepare SQL ONLY once and Execute Multiple times

Posted by Felix Schumacher <fe...@internetallee.de>.
Hi Jeff,

enhancement issue has been filed with
https://bz.apache.org/bugzilla/show_bug.cgi?id=65515

It would be nice, if you could test the next nightly
(https://jmeter.apache.org/nightly.html) or successful build from trunk
and report back, whether it works for your use case.

Felix

Am 18.08.21 um 18:08 schrieb Jeff Lutzow:
> Correction.... your suggestion to use that JSR223 Sampler with that Groovy code works well and only does 1 Prepare followed by many Open, Fetch, Close, Open, Fetch, Close....etc.
>
> Hi Jeff,
> seems, that the prepared statements are not cached by default (and there is currently no nice way to enable it via the GUI).
> You can try to enable the prepared statements cache on the pool by using a bit of JSR223 Groovy code:
> ds = vars.getObject("AVZ1Server").configuredDataSource
> log.info("ds.preparedStatements: {}",  ds.poolPreparedStatements)
> ds.poolPreparedStatements = true
> ds.maxOpenPreparedStatements = 10 // adapt to your needs
> log.info("ds.preparedStatements: {}",  ds.poolPreparedStatements)
> Add a JSR223 Sampler (use Groovy as language) before the first usage of the connection and copy the above code to it.
> Does that help? If so, you might want to open a bugzilla issue to add a flag to enable prepared statement caching via the GUI.
> Felix
>
>
> Thanks very much for your help!!!
>
> I guess I should open a bug request like you suggested and have this added into the JMeter GUI.
>
> Jeff
>
> -----Original Message-----
> From: Felix Schumacher <fe...@internetallee.de>
> Sent: Wednesday, August 18, 2021 9:44 AM
> To: Jeff Lutzow <jl...@rocketsoftware.com>
> Subject: Re: FW: Have JMeter Prepare SQL ONLY once and Execute Multiple times
>
> EXTERNAL EMAIL
>
>
>
>
> ================================
> Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ Main Office Toll Free Number: +1 855.577.4323
> Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
> Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
> Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
> ================================
>
> This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.


Re: FW: Have JMeter Prepare SQL ONLY once and Execute Multiple times

Posted by Felix Schumacher <fe...@internetallee.de>.
Hi Jeff,

seems, that the prepared statements are not cached by default (and there
is currently no nice way to enable it via the GUI).

You can try to enable the prepared statements cache on the pool by using
a bit of JSR223 Groovy code:

ds = vars.getObject("AVZ1Server").configuredDataSource
log.info("ds.preparedStatements: {}",  ds.poolPreparedStatements)
ds.poolPreparedStatements = true
ds.maxOpenPreparedStatements = 10 // adapt to your needs
log.info("ds.preparedStatements: {}",  ds.poolPreparedStatements)

Add a JSR223 Sampler (use Groovy as language) before the first usage of
the connection and copy the above code to it.

Does that help? If so, you might want to open a bugzilla issue to add a
flag to enable prepared statement caching via the GUI.

Felix

Am 17.08.21 um 16:29 schrieb Jeff Lutzow:
>
>  
>
>  
>
> *From:* Jeff Lutzow
> *Sent:* Tuesday, August 17, 2021 9:28 AM
> *To:* JMeter Users List <us...@jmeter.apache.org>
> *Subject:* RE: Have JMeter Prepare SQL ONLY once and Execute Multiple
> times
>
>  
>
> Here is my setup.  I only have 1 thread.
>
>  
>
>  
>
>  
>
>  
>
> In the Trace for the DVM Server that these requests are being run on
> it does a Prepare everytime.
>
>  
>
>
>  
>
>
>  
>
>
>  
>
> -----Original Message-----
> From: Felix Schumacher <felix.schumacher@internetallee.de
> <ma...@internetallee.de>>
> Sent: Tuesday, August 17, 2021 4:06 AM
> To: user@jmeter.apache.org <ma...@jmeter.apache.org>
> Subject: Re: Have JMeter Prepare SQL ONLY once and Execute Multiple times
>
>  
>
>  
>
> Am 27.07.21 um 20:25 schrieb Jeff Lutzow:
>
> > Is there a way to accomplish the above?    Everything I have tried I
> still see JMeter “Prepare” the SQL statement every time when using the
> JDBC driver to connect to IBM Data Virtualization Manager.
>
> > 
>
> > I would like to run a test where it runs the same request multiple
> times but ONLY Prepares the request one time.
>
>  
>
> How do you test, that the statements are prepared every time?
>
>  
>
> What is the setup of your pool definition (in the JDBC Connection)?
>
>  
>
> Do you want to share the connections over all the threads? (This is
> not the default in JMeter. Every thread/user has its own connection
> unless configured otherwise)
>
>  
>
> Felix
>
>  
>
>  
>
> > 
>
> > 
>
> > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986
> <https://go.microsoft.com/fwlink/?LinkId=550986>> for
>
> > Windows 10
>
> > 
>
> > 
>
> > ================================
>
> > Rocket Software, Inc. and subsidiaries ¦ 77 Fourth Avenue, Waltham MA
>
> > 02451 ¦ Main Office Toll Free Number: +1 855.577.4323 Contact Customer
>
> > Support:
> https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
> <https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport>
>
> > Unsubscribe from Marketing Messages/Manage Your Subscription
>
> > Preferences -
>
> > http://www.rocketsoftware.com/manage-your-email-preferences
> <http://www.rocketsoftware.com/manage-your-email-preferences>
>
> > Privacy Policy -
>
> > http://www.rocketsoftware.com/company/legal/privacy-policy
> <http://www.rocketsoftware.com/company/legal/privacy-policy>
>
> > ================================
>
> > 
>
> > This communication and any attachments may contain confidential
> information of Rocket Software, Inc. All unauthorized use, disclosure
> or distribution is prohibited. If you are not the intended recipient,
> please notify Rocket Software immediately and destroy all copies of
> this communication. Thank you.
>
> > 
>
>  
>