How jmeter pressure measurement and storage

1. Stored procedure preparation:

1. Create an empty table:

1

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

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 IN 1..n LOOP

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

  END LOOP;

COMMIT;

END insert_test_data;

3. Under 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 (version is not limited), put it in the Jmeter directory \lib\ext.

2. Find or put the local: ojdbc14.jar on the Internet, and put it in the Jmeter directory \lib.

3. Tool configuration and execution:

The global configuration is as follows:

1, Deploy JDBC Connection Configuration:

Right-click, add a node under Config Element, the configuration is as shown in the figure:

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

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

c. A large section in the middle is temporarily defaulted, and Validation Query chooses 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 80% query and 20% write scenario.

3. Configure JDBC Request:

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

For stored procedures:

a. Variable Name of Pool...: Consistent with JDBC Connection Configuration configuration, here 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, write in the format shown 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, the data type of the parameter

f. Variable names, return value column name

g. HandleResutleSet:Store as String will do

For SQL statements:

Select Select Statement for Query Type, and write SQL statements 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

For other jmeter-related suggestions, watch the video below

2023 latest Jmeter interface test from entry to proficiency (full set of practical project tutorials)

Guess you like

Origin blog.csdn.net/m0_68405758/article/details/132173895
Recommended