JMeter: How to benchmark data deletion from database table in batches?

我怕爱的太早我们不能终老 提交于 2019-12-13 04:05:12

问题


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.

  1. How should I define my While Controller to achieve this?

  2. 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?


回答1:


  1. Add Transaction Controller to be a top level test element under the Thread Group
  2. Add While Controller as a child of the Transaction Controller and use the following condition expression:

    ${__jexl3(${count_1} > 0,)}
    
  3. Put your JDBC Request sampler as a child of the While Controller
  4. Add JDBC PostProcessor as a child of the JDBC Request sampler and configure it like:

  5. 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.




回答2:


I would do it this way:

  1. Use the "JDBC Request - Get Count" sampler to get the data from the db which has to be deleted
  2. Use a BeanShell Assertion to check if there is more data that can be deleted. Otherwise stop the thread
  3. Execute the request to delete the data
  4. Thread Group should stop Test on error


来源:https://stackoverflow.com/questions/54740549/jmeter-how-to-benchmark-data-deletion-from-database-table-in-batches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!