In daily work, whether it is doing functional testing, interface testing or performance testing, there is often such a scenario, “that so-and-so, help me add a few orders”, “that so-and-so, add a few more orders to the shopping cart. Products”, “Add hundreds of pieces of data to the database”. . . Wait, usually a small number, or can be solved manually, then if the number is relatively large, tens of thousands of data, it is impossible to add one by one, right?
So, what you can usually think of when creating data is that the database is added through “stored procedures”, or external programs or tools, which Jmeter also supports, of course, and a small demo:
Original: JDBC Connection Pool
The specific configuration has been mentioned in the previous article and will not be explained here.
Thread group join cycle times
OK, 100 pieces of data are added in batches, and the primary key is not repeated.
ou can see that the data in the database has been added successfully!
Of course, Jmeter is always a test tool for batch addition, and Jmeter itself consumes more machine performance, so in some cases it is also necessary to use stored procedures.
Therefore, remember a second method of batch data creation – “stored procedure batch data creation”:
drop procedure if exists proc_auto_insertdata$$
create procedure proc_auto_insertdata ()
declare init_data int;
while init_data <=20000 DO
insert into users values (init_data,concat(‘user-‘,init_data));