jemeter批量入mysql表,JMeter:如何批量从数据库表中删除数据?

作者尝试用JMeter对比DELETE批量大小的性能差异,先向表中填充大量测试数据,通过JDBC请求执行删除语句,想持续执行直到表为空并记录清表时间,多次运行线程获取平均执行时间。还询问了如何定义While Controller和Transaction Controller,最后给出了解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am trying to compare the performance difference between DELETE batch sizes using JMeter.

I have a table which I populate with a large amount of test data. Next, I have a JDBC Request that runs the following statement:

delete from tbl where (entry_dt < '2019-02-01') and (rownum <= 10000);

I want to keep running this until the table is empty, and record the time taken to clear the table.

I will run this thread multiple times to get an average execution time, and repeat this process for different batch sizes.

How should I define my While Controller to achieve this?

I read from other sites that I can use a Transaction Controller to time my process, but I am not familiar with this feature. How should I define my Transaction Controller to achieve this?

解决方案

Add Transaction Controller to be a top level test element under the Thread Group

Add While Controller as a child of the Transaction Controller and use the following condition expression:

${__jexl3(${count_1} > 0,)}

Put your JDBC Request sampler as a child of the While Controller

Add JDBC PostProcessor as a child of the JDBC Request sampler and configure it like:

PQlF2.png

That's it, While Controller will iterate until there are entries in the tbl table and the Transaction Controller will record the cumulative time of all JDBC Request samplers executed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值