Liunx integrates jmeter for pressure measurement practice

First, the liunx environment needs to deploy jdk
1, and obtain the jmeter free installation package: click me to get the free installation package

2, Get the jmeter-manger tool for generating reports, logs, etc.
Click me to get the tool

3. Create a new folder on the server to store jmeter. It is recommended to be under /usr/local/. Due to permission issues, I created it under my own directory: 3.1 Enter the specified directory first: 3.2 Create the jmeter
folder cd /home/springcloud/
:mkdir jmeter

4. Upload the jmeter free installation package in the first step to the jmeter directory, here you can use xftp to upload directly! Of course, you can also use the command to upload, upload command: rzand then press Enter, you can select the file to be uploaded, I use the tool xftp here, directly find the newly created folder, and then upload it:
insert image description here

5. After uploading, we switch to the current jmeter directory to decompress the compressed package (the premise is that there is a decompression tool, if not, you can install it yourself) 5.1 Switch to the jmeter directory: 5.2 Decompress the compressed package just uploaded: After decompression
is cd jmeter
complete tar zxvf apache-jmeter-5.5.tgz
, There are two things under the jmeter directory:
insert image description here
don’t worry about the compressed package, you can also delete it

6. Then upload the jmeter-manger plug-in to the decompression directory of jmeter /jemter/apache-jmeter-5.5/lib/ext. Below
insert image description here
7, if it is convenient to use jmeter globally, it is recommended to configure the environment variables here:
7.1 Enter the etc directory : cd /etc/
7.2 Open the profile file for editing: vim profile
7.3 Copy the following content to the blank space: (Note that the home address below is the decompression address of your jmeter)
export JMETER_HOME=/home/springcloud/jemter/apache- jmeter-5.2.1
export CLASSPATH= JMETERHOME/lib/ext/Apache JM etercore .jar : JMETER_HOME/lib/ext/ApacheJMeter_core.jar:J METE RHOME/lib/ext/ApacheJMetercore . ja r:JMETER_HOME/lib/jorphan.jar: C L A S S P A T H e x p o r t P A T H = CLASSPATH export PATH= CLASSPATHexportPATH=JMETER_HOME/bin: P A T H : PATH: PATH: HOME
insert image description here
7.4 Press the [esc] key on the keyboard to exit, press the esc key and enter: [:wq] and then press the [enter] key to save and exit 7.5 Refresh and save the environment variables to make the configuration file take effect:
source /etc/profile
7.6 Verify whether the environment variable is configured successfully. If the following interface is displayed, it means success: jmeter -v
insert image description here
8, and then create two folders under jmeter to store stress test scripts and log information
. 8.1 Switch to the jmeter directory:cd jmeter
8.2 Create a test script:mkdir jmeter-script
8.3 Create a log file:mkdir log
In this way, there are the following four files under the jmeter directory:
insert image description here
Then upload the test script to jmeter-script
and switch to the jmeter-script directory:cd jmeter-script

insert image description here
9. Let’s start the pressure test.
Enter the script directory:
switch to the jmeter-script directory: cd jmeter-script
then execute the command to perform the pressure test:

jmeter -n -t 预约.jmx -l ../log/result-sy.jtl

Command description:
insert image description here

Result:
insert image description here
At this time, there will be an additional jtl file under the log, which is the execution result,
insert image description here
switch to the jmeter-script directory: cd jmeter-script
execute the following command to turn this jtl into an html report:

jmeter -g result-yy.jtl -o /home/springcloud/jemter/log/result-yy

Result:
insert image description here
After this file appears, you can pack the jtl file into a compressed package and upload it locally for viewing
Use the command to pack the jtl
packaging command: tar zcvf result-yy.tar.gz result-yyNote that the command must end with .tar.gz
Finally, use the following command to download it locally for viewing:

sz result-yy.tar.gz

You can only access it after downloading it locally and decompressing it!
Result:
insert image description here
over!
Note that the parameter path of the uploaded script text should not be mistaken!
insert image description here
Finally attach the test script:
insert image description here

Link: https://pan.baidu.com/s/1KaOX8IQtKZCgxIE-56M4kA
Extraction code: juge

Note: If you use stress testing on windows, after downloading the tool, import the above script directly to see the demo

Guess you like

Origin blog.csdn.net/gelinwangzi_juge/article/details/127926617