Jmeter's performance test continuous integration

First, we can choose Jenkins to implement continuous integration of performance testing. The specific steps are as follows:

1. Installation of Performance Plugin

Method 1. Online installation: system management-management plug-in-optional plug-in interface, find the plug-in that needs to be installed: Performance Plugin,

Install directly after checking

Remarks: When using method 1, if the plug-in cannot be downloaded, expand the Failure information, find the corresponding hpi information, and change it.

Domestic mirror download,

For example: Mirror address of Tsinghua University: https://mirrors.tuna.tsinghua.edu.cn/jenkins/

Path to update the mirror address: System Management—Management Plug-in—Advanced—Upgrade Site

Method 2. Offline installation: download the hpi file of the plug-in, in Jenkins: System Management—Manage Plug-in—Advanced—Upload the plug-in, upload directly

Plug-in

Remarks: performance hpi file path: https://updates.jenkins.io/download/plugins/performance/
Email Extension Plugin download address: https://updates.jenkins.io/download/plugins/email-ext/
Publish HTML reports Plug-in download address: https://plugins.jenkins.io/htmlpublisher/
HTML Publisher plugin is installed by default in general jenkins version

If the installation fails, it may be that the version of the plug-in is too high or too low, which is not compatible with the current Jenkins, and you need to use another version of the plug-in

2. Continuous integration of performance testing

1. Install Jenkins, and use the machine where Jenkins is installed as the dispatcher, install Jmeter on the dispatcher, and test the performance

Upload the script and data to the machine, that is, the Jenkins server is also the scheduling machine

Remarks: JDK should also be installed synchronously on the machine, and other software such as git and python may need to be installed according to actual needs.

Dispatcher configuration

(1) Modify the configuration of the jmeter.properties file:

1) Uncomment server.rmi.ssl.disable=false and change false to true

2) Add a line java.rmi.server.hostname=10.12.224.215 at the end of the file, hostname is the IP address of the machine

3) If necessary, customize the communication port, the default port is 1099: if modified to 1089

 server_port=1089

 server.rmi.localport=1089

4) Update remote_hosts to the IP and port of the executor. The default value of the port is 1099, which can be customized as above. It is used in the middle of multiple executors.

Separate by commas. If the dispatcher is used as both a dispatcher and an executor, the dispatcher IP and port need to be added.

2. Install Jmeter on the execution machine and upload the performance test data to the machine

Note 1: JDK should also be installed synchronously on the machine, and other software such as git and python may need to be installed according to actual needs.

The version of it is best to be consistent with the scheduling machine

Execution machine configuration

(1) Modify the configuration of the jmeter.properties file:

1) Uncomment server.rmi.ssl.disable=false and change false to true

2) Add a line java.rmi.server.hostname=10.12.224.215 at the end of the file, hostname is the IP address of the machine

3) If necessary, customize the communication port, the default port is 1099: if modified to 1089

 server_port=1089

 server.rmi.localport=1089

4) Update remote_hosts, because the executor also needs to send messages back, so remote_hosts also needs to configure the IP and port of the dispatcher
Insert picture description here(2) enter the command to start the executor agent

sh /web/performance/apache-jmeter-4.0/bin/jmeter-server

(This parameter information needs to be added when the startup is abnormal, hostname is the IP address of the agent machine

-Djava.rmi.server.hostname=10.16.244.150

Note: The command to start jmeter server in linux is: sh jmeter-server

For windows, double-click to open: jmeter-server.bat

Here is to start the jmeter service on the slave. If the following figure appears, the startup is successful.

The above IP and Port are the IP and port configured in the remote_hosts of the dispatcher
Insert picture description here
:

The dispatcher starts the proxy service, the error message:

root@ranxf:/home/ranxf/apache-jmeter-3.1/bin# ./jmeter-server
Writing log file to: /home/ranxf/apache-jmeter-3.1/bin/jmeter-server.log
Created remote object: UnicastServerRef [liveRef: [endpoint:[127.0.1.1:45261](local),objID:[-77439517:162bd0d02af:-7fff, -6895836418342878128]]]
Server failed to start: java.rmi.RemoteException: Cannot start. ranxf is a loopback address.
An error occurred: Cannot start. ranxf is a loopback address.

solution:

Execute again after adding parameters to jmeter-server:

sh /web/performance/apache-jmeter-4.0/bin/jmeter-server -Djava.rmi.server.hostname=10.16.244.150

3. Create a new job in Jenkins and add build steps

If the scheduling machine is a linux operating system, select "execute shell"; if the scheduling machine is a windows operating system, select "execute windows"

Batch command"
Insert picture description here

cd /web/performance/apache-jmeter-4.0/bin
git pull http://gitlab.wumart.com/dmall-scm/wms_performance.git
sleep 2
cd /web/performance
rm -rf report
rm -rf testResult.jtl
sleep 2
sh /web/performance/apache-jmeter-4.0/bin/jmeter.sh -n -t /web/performance/apache-jmeter-4.0/bin/performancScript.jmx -R 10.16.244.150:1089 -l /web/performance/testResult.jtl -e -o /web/performance/report

Note: The test report folder must be empty or does not exist (if it does not exist, the folder will be created automatically and the test report will be saved in it),

The parameter is the report folder path

Linux executes the jmete script command as: sh jmeter.sh windows as: jmeter

4. Add post-build operation Publish HTML reports

The HTML Publisher plugin needs to be installed. Generally, the HTML Publisher plugin is installed by default in the jenkins version

(1) After building, select Publish HTML reports plug-in and configure information
Insert picture description here
Description:

HTML directory to archive: test report save path

index page[s]: You can keep the default value

index page title[s]: The name of the test report page

Report title: test report naming

5. Add post-build operation Publish Performance test result report

Insert picture description here
Description:

Source data files: The path of the performance test result file, as listed above is the performance test result file whose scheduler is the linux operating system

path

6. View the result report through HTML Report
Insert picture description here
7. Other matters:

1. jmeter.properties, you may encounter permission problems that cannot be opened or other file permission problems:

You can use: chmod 777 filename to add permissions, and then you can open it again

2. Custom port: The communication port between client and server, you don’t need to modify it, the default is 1099

In the bin directory of Jmeter on the slave machine, find the jmeter.properties file and modify the following two configuration items, such as

I am here to modify it to 1888:

server_port=1888

server.rmi.localport=1888

3. Make sure that the jmeter and java versions of the scheduler and the executor are the same. Different versions may have coordination problems

4. The dispatcher and the executor need to turn off the firewall.

5. The dispatcher and executive bureau network need to be kept in the same local area network and can be pinged

6. The execution machine does not need a performance test script, because the dispatching machine sends the script to each execution machine by command, but if

The test uses external data files, so please note that these files will not be distributed by the scheduling machine, so the tester needs to ensure that each

These data files are saved on the execution machine, and the file path is correct

7. Sometimes there are too few machines used as the execution machine to meet the needs, and the computer of the dispatching machine needs to be used as the execution machine.

In this way, you need to modify the jmeter.properties file and write the IP of the scheduler to remote_hosts. At the same time, this time you need to play

Open the jmeter-server.bat in the %JMeter_home%/bin directory of the master computer,

Then open jmeter.bat. It is not recommended to use the scheduling machine as an executor when it is not necessary, because task scheduling and collecting result information

Information and summarization also consume system resources

Guess you like

Origin blog.csdn.net/baidu_24752135/article/details/106695871