Run Jmeter pressure test under Linux

1. Install the SDK on the Linux server first

1. First download jdk1.8.0_131.tar.gz from the official website, and then upload it locally to the Linux server

2. Decompression: tar -xzf jdk1.8.0_131.tar.gz, generate folder jdk1.8.0_131

3. Create a java folder in the /usr/ directory, and then move the jdk1.8.0_131 directory to /usr/java

1) cd /usr/

2) mkdir java

3) mv jdk1.8.0_131 /usr/java

?3. Configure java environment variables

1) vi /etc/profile

2) Add two lines at the end

 export JAVA_HOME=/usr/local/java/jdk1.8.0_131

 export PATH=$JAVA_HOME/bin:$PATH

The configuration will take effect after restarting the virtual machine

3) Execute the command: source /etc/profile, no need to restart, the configured environment variables will take effect immediately

 Or execute the following command (must be root role, normal role has no permission)

 # export JAVA_HOME=/usr/local/java/jdk1.8.0_144

 # export PATH=$JAVA_HOME/bin:$PATH

4. To check whether the installation is successful, execute the command: java-version

2. Install Jmeter

1. Package the local Jmeter file into a zip file:, and upload it to the server

2. Unzip it on the server and generate the apache-jmeter-3.1 directory

1) Install unzip: apt-get install unzip

2) Unzip: unzip

3. Create folder mkdir apache-jmeter-3.1

3. Put the apache-jmeter-3.1 directory under /usr/local/apache-jmeter-3.1


4. Configure Jmeter environment variables. vi /etc/profile, and add the following variables

export JMETER_HOME=/usr/local/apache-jmeter-3.1/apache-jmeter-3.1

export CLASSPATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:


export PATH=



















5. source /etc/profile (let the configuration file take effect immediately)

6. To check whether the installation is successful, execute the command: jmeter -v


3. Interface pressure test

1. Upload the locally generated jmx file to the specified directory on the server, such as: /usr/local/apache-jmeter-3.1/jmx

2. Enter the directory and enter the command: # jmeter -n -t Linux_uat_createOrder5bf60s.jmx -l result.jtl to view the results

jmeter -n -t -l Example: jmeter -n -t testplan.jmx -l test.jtl

Parameter Description:

-n: Run the script in NoGUI mode

 -t: followed by the script name

                 -l: Followed by the log name, save the running results


3. View result.jtl to view the running results:


You can also send result.jtl to Jmeter under Windows for viewing: add an aggregate report, and open the file in the aggregate report:


4. Note: It is best to keep the Jmeter version of the client and server consistent, otherwise an error will be reported when running the script.

5. There is another script execution command:

#jmeter -n -t Linux_uat_createOrder5bf60s.jmx -l result.jtl -e -o /usr/local/apache-jmeter-3.1/result

There must be an empty result folder in the /usr/local/apache-jmeter-3.1/ directory, otherwise an error will be prompted.

After the instruction is executed, the entire result folder is downloaded to the local. The folder contains:


Open index.html, you can see the result report of the web version:


For details, please refer to the relevant information, and will not go into details for now.

4. Advanced pressure test

Distributed pressure measurement of multiple pressure measurement machines:

For example, use 41 as the master and 42 and 43 as slaves to perform stress testing on the servers in the stress testing environment.

1. The three Linux servers must install the same version of Jmeter, and try to ensure that the installation paths are consistent;

2. Configure the of 41, and configure the IP and port numbers of the two slave machines (42, 43):

Directory: /usr/local/apache-jmeter-3.1/apache-jmeter-3.1/bin

Configure remote_hosts, remove the previous comment #:


3. Place the same jmx script on the three Jmeter machines. In the aggregate report of the script, set the path to write the result to the file:

/usr/local/apache-jmeter-3.1/jmx/logs/createOrderResultKaTeX parse error: Expected group after ‘_’ at position 2: {_?_time(YMD)}{__time(HMS)}.jtl

The execution results of the pressure test will be placed in the /usr/local/apache-jmeter-3.1/jmx/logs directory, and a jtl file with a date and time stamp will be automatically generated:


4. Before the host 41 initiates the pressure test command, two slave machines 42 and 43 need to be started:

Directory: /usr/local/apache-jmeter-3.1/apache-jmeter-3.1/bin

Command: ./jmeter-server


At this point, the slave service has been started.

5. Execute the script command on the host 41: # jmeter -n -t Linux_uat_createOrder8bf60s.jmx -r

Parameter description: -r remote execution -> all remote servers specified in the file


Display host 41 shows that it has started (41 does not directly measure pressure, remote control 42, 43 for pressure measurement)

The two slaves also show that they have received the pressure test command and started the pressure test:

42 machines:


43 machines:


The host 41 displays: end of run, indicating that the pressure test is completed:


After executing the script, go to the directory /usr/local/apache-jmeter-3.1/jmx/logs to find the generated jtl file, download it to the local machine Windows environment, and use the jmeter aggregation report to view the results, as shown in the figure:

Finally: In order to give back to the hard-core fans, I have compiled a complete software testing video learning tutorial for you. Friends can get free 【Guaranteed 100% Free】 code>

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

How to obtain the full set of information: © 2021 All Rights Reserved.