Teach you Jmeter distributed pressure measurement from 0 to 1

1. Why does jmeter do distributed pressure testing

Limitations of jmeter itself

The number of threads supported by Jmeter of a press is limited by Jmeter's own mechanism and hardware configuration (memory, CPU, etc.)

Since Jmeter is  a Java  application, it consumes a lot of CPU and memory. When it is necessary to simulate a large number of concurrent users, a single machine is prone to JAVA memory overflow errors, resulting in a bottleneck in the test script itself.

Limitations of JVM heap memory

The jvm heap memory heap of a Java application is limited by the press hardware, although we can adjust the heap memory size

When cmd enables Jmeter GUI, there will also be a prompt

increase Java Heap to meet your test requirements: Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file

Translation: Increase the Java heap memory to meet the requirements of the test

However, a single machine cannot support tens of thousands of concurrency. At this time, multiple presses are needed for distributed stress testing , so that the performance bottleneck will not be our presses.

Lenovo scene

· Test the scenario of 1000 thread concurrency, but a single machine can only support 200 concurrency and cannot reach 1000

·  Through distribution (from 5 machines) can simulate 1000 concurrency

Distributed stress testing

Jmeter supports distributed pressure measurement, and distributes a large number of concurrent users that need to be simulated to multiple presses, so that Jmeter has a larger load and meets real business scenarios (high concurrency scenarios).

The ultimate goal of distribution

Ensure that the press does not experience performance bottlenecks

When performing performance analysis later, there is no need to consider whether the press will cause one of the main reasons for performance bottlenecks 

2. Distributed principle

After reading the animation above, you will understand. The principle is as follows:

1. Cnotroller is the control machine, Slaves are multiple presses

2. In distributed testing, Cnotroller distributes test scripts to all Slaves through the command line

3. Slave does not need to start the Jmeter GUI, and executes the test through the CLI mode

4. After the Slave finishes executing, it will send the result back to the Master

5. Master collects the results of all Slaves and aggregates them into a result set

Notice

The press machine can also be called: load machine, agent machine, executive machine, broiler... various names, but they are all Slave.

Master can also execute test scripts, or it can only be responsible for management without execution.

3. The prerequisites for distributed pressure testing have been configured

Precautions:

1. Keep the configuration versions of JDK, jmeter and plug-ins of Contorller and Slave machines consistent;

2. If the test data is parameterized by CSV or other methods, it is necessary to copy the data on each Slave, and the reading path must be consistent;

3. Make sure that Contorller and Salve machines are in the same subnet;

4. Check whether the firewall is closed and whether the port is occupied (the firewall will affect the script execution and test structure collection, and the port occupation will cause the Slave machine to report an error);

5. In the distributed test, by remotely starting the proxy server, the response data in the result tree is empty by default, and only the error message will be reported;

6. If the concurrency is high, it is recommended to set the Contorller machine to only start the test script and collect and summarize the test results, and remove the IP of the Contorller machine in the configuration file;

1. Modify the Contorller configuration

Open the bin directory under the jmeter installation file under the Contorller machine: the jmeter.properties file, search for remote_hosts=127.0.0.1, and write the IP and port of the Slave machine behind, for example:

remote_hosts=127.0.0.1:1099,172.16.6.90:1099,172.16.6.91:1099

 

Among them, 172.16.6.90 and 172.16.6.90 are the IP of the Slave machine, and each Agent machine is separated by a comma in English, modify and save. Note that the default port is 1099

Remember to modify regardless of the master machine: server .rmi.ssl.disable=true, and remove #, otherwise an error will be reported

2. Load machine

First install the jdk and jmeter environment, see my last article for details. Then open the configuration file /bin/jmeter.properties, find and cancel the comment server.rmi.ssl.disable=false of this configuration, and change false to true.

# Password of Trust store
  #server.rmi.ssl.truststore.password=changeit
  #
  # Set this if you don't want to use SSL for RMI
  server.rmi.ssl.disable=true      # 改成true

Enter the command: jmeter-server -Djava.rmi.server.hostname=172.16.2.114 to start the anget node. The parameter behind jmeter-server specifies the IP of the agent.

 3. Start jemter

After starting jmeter, set the thread group, configuration components, samplers, listeners and other components, and click "Run-Remote Start"

 

You can choose to start a Slave machine remotely, or choose to start all of them remotely, and then you can perform distributed testing. 

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive  

 

Guess you like

Origin blog.csdn.net/okcross0/article/details/132147292