Performance test – stress test the stored process through Jmeter!

Table of Contents

1. Stored procedure preparation:

2. Preparation of test tools:

3. Tool configuration and execution:

2. Configure the throughput controller (can be skipped):

3. Configure JDBC Request:

For stored procedures:

For SQL statements:

4. Other configurations such as query result tree, aggregation report, TPS, PerfMon monitoring, etc. are the same as the basic Jmeter configuration.

1. Stored procedure preparation:

1. Create an empty table:

1

CREATE TABLE test_data ( id NUMBER, name VARCHAR2(50), age NUMBER ); code>

2. Create a stored procedure:

1

2

3

4

5

6

7

8

9

CREATE OR REPLACE PROCEDURE insert_test_data

(n IN NUMBER) AS

BEGIN

--EXECUTE IMMEDIATE 'truncate table test_data';

FOR i IN 1..n LOOP

INSERT INTO test_data VALUES (i, 'Name' || i, i * 10);

END LOOP;

COMMIT;

END insert_test_data;

3. Debugging:

1

select count(*) from test_data t; call insert_test_data(1000); truncate table test_data;

2. Preparation of test tools:

1. Found on the Internet: mysql-connector-java-8.0.29.jar (the version is not limited), and put it in the Jmeter directory \lib\ext.

2. Find it online or put it locally: ojdbc14.jar in the Jmeter directory \lib.

Now I have also found a lot of testing friends and created a communication group to share technology, sharing a lot of technical documents and video tutorials we collected.
If you don’t want to experience the feeling of not being able to find resources when studying on your own, having no one to answer your questions, and persisting for a few days before giving up.
You can join us to communicate. And there are many technical experts who have made certain achievements in automation, performance, security, test development, etc.
Share their experience, and also share many live lectures and technical salons
You can learn for free! Focus on it! Open source! ! !
QQ group number: 110685036

3. Tool configuration and execution:

The global configuration is as shown below:

1. Configure JDBC Connection Configuration:

Right-click and add a node under Config Element. The configuration is as shown:

a. The name can be changed at will, and it will take effect after saving.

b. Variable Name for created pool, choose any one, but it needs to be consistent with the configuration of the subsequent steps. It is recommended to call it oracle.

c. The large section in the middle is temporarily defaulted, and Validation Query can choose one at will.

d. Database URL: jdbc:oracle:thin:@{ip}/{oracle service name}, where {ip} is the database server ip, {oracle service name} is the Service_Name in TNS, similar to orcl

e. Username and password to connect to the database

2. Configure the throughput controller (can be skipped):

As shown in the figure, it accounts for 20% of the throughput. In the example, SP accounts for 20% and SQL accounts for 80%. Simulate the actual scenario of 80% query and 20% write.

3. Configure JDBC Request:

Right click, find JDBC Request in Sampler, and add it.

For stored procedures:

a. Variable Name of Pool…: The configuration is consistent with the JDBC Connection Configuration, here it is configured as: oracle

b. Query Type: For stored procedures, select Callable Statement

c. Query: As shown in the picture, write the stored procedure call according to the format in the picture. The parameters are represented by ?, and multiple parameters are separated by commas.

d. Para Values, parameter values, multiple separated by commas

e. Para types, data type of parameters

f. Variable names, return value column name

g. HandleResutleSet: Store as String

For SQL statements:

Select Select Statement for Query Type and write the SQL statement directly in Query. Be careful not to write “;” at the end of the statement

4. Other configurations, such as query result tree, aggregation report, TPS, PerfMon monitoring, etc., are the same as the basic Jmeter configuration. Basic Jmeter configuration

END Today’s sharing ends here. If it helps you, leave a message!