Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using jmeter to create data

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Project testing process, encountered such a requirement, need a table with millions of data, the requirement is very simple, originally wanted to use jdbc to write java directly into the database to insert data, and then remembered that jmeter can achieve this requirement, and more simple and convenient, so use jmeter to do the next data preparation work, and now record the process.

1 Open jmeter and create a thread group:

2 right mouse button stand-alone thread group to create a jdbc connection configuration:

Fill in the address, user name, and password of the database:

3 create user parameters:

You can create parameter functions according to different fields in the data to be inserted:

The generation of a function is generated by a function generator:

Generation of different functions:

You can also use a counter as a function:

4 add a jdbc request to the thread group:

Add a sql statement to jdbc request:

Among them, those with special requirements for fields (that is, fields that are parameterized and use functions) are reflected in the lost format in a specific format of "${your parameters}":

Parameterized fields:

5 add aggregate report and view the result tree, and check the data according to the order of magnitude you need:

This makes it possible to insert the data.

Experience:

1 in the case of a small amount of data, using java through the interface or inserting data directly should take about the same time as using jmeter, but if the amount of data reaches more than one million, the speed will be much faster by using jmeter multithreading.

2 the operation of jmeter is relatively simple, if there is no ready-made project, it is troublesome to build the environment, and debugging the code is a bit annoying. But with jmeter, you only need a simple sql, a few steps to complete the task, the advantage is more obvious.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report