This is the fifth day of my participation in the More text Challenge. For details, see more text Challenge

introduce

Apache JMeter is a Java-based stress test tool developed by the Apache organization. Used to stress test software, it was originally designed for Web application testing but has since expanded to other areas of testing. It can be used to test both static and dynamic resources, such as static files, Java miniservers, CGI scripts, Java objects, databases, FTP servers, and so on.

1. Install the JDK

Jmeter is written in Java, so you need to install a Java environment to run Jmeter

Here we directly use yum to install without reference to Redhat install yum

Yum -y install Java -- 1.8.0 comes with its *Copy the code

Installing with yum automatically configures environment variables.

2. Install the Jmeter

Download the Installation Package

Download the binary package from the official website

You can also download the file and upload it to a Linux serverwgetThe command to download

Wget HTTP: / / https://mirrors.tuna.tsinghua.edu.cn/apache//jmeter/binaries/apache-jmeter-5.4.1.zipCopy the code

Decompressing a Compressed Package

Unzip the apache jmeter - 5.4.1. ZipCopy the code

Configuring Environment Variables

Edit the /etc/profile file and configure Jmeter environment variables. After the configuration, you can run Jmeter commands anywhere

If you do not want to configure environment variables, you can also use./jmeter in the bin directory

export PATH=/usr/local/ apache jmeter - 5.4.1 / bin / :$PATH
Copy the code

Making the configuration Effective

source /etc/profile
Copy the code

Use Jmeter

You need to write a script in window and upload it to Linux

jmeter -n -t /usr/local/test.jmx -l /usr/local/test.jtl &
Copy the code

If environment variables are configured, you can run the jmeter command. If environment variables are not configured, run./jmeter -n -t in the bin directory of jMeter

Parameter description: -h Help -> Print out useful information and exit -n non-GUI mode -> Run JMeter -t test file in non-GUI mode -> JMeter test script file to run -l Log file -> File to record results -r Remote execution -> Start the remote service. -h Proxy host -> Set the proxy host used by JMeter -p Proxy port -> Set the port number of the proxy host used by JMeterCopy the code

The test results will be stored in the.jtl file. Take the window and open the GUI program

Create a summary report

Open the JTL file to see the results