Jmeter implements distributed concurrency

In the performance testing process, the following embarrassing scenarios will occur when high-concurrency operations are performed, the JMeter client is stuck, request errors, or timeouts. To solve this problem, we need to distribute a large operation to multiple servers On top, multiple servers bear the load pressure.

Next, let's take a look at how to achieve distributed concurrency of jmeter:

Need to configure jdk environment and jmeter environment on the load machine

First, we need to prepare a load machine. The load machine in this demonstration is a Linux server built by the blogger on the virtual machine. The Linux system needs to install jdk (if you do n’t know how to configure jdk, please Baidu) and then configure jmeter in the Linux environment. surroundings:

Official website download jmeter version

https://mirrors.tuna.tsinghua.edu.cn/apache//jmeter/binaries/, I downloaded apache-jmeter-5.1.1.tgz

Put the downloaded package in the / usr / local directory ( this directory can be set by myself, I usually install the installation package in this directory ), enter this directory to extract the files

 

 

 

Configure environment variables, enter the root directory and enter the command vim etc / profile to configure environment variables

export JMETER_HOME = / usr / local / apache-jmeter-5.1.1 ( do not copy it, change to your own path )
export PATH = $ JMETER_HOME / bin: $ PATH

 

 

 Then enter jmeter -v to verify, if the following interface appears, then congratulations that you have successfully configured jmeter in the Linux environment

 

 

Then enter jmeter's bin directory to start jmeter, command: ./jmeter.sh, you can see the successful start

 

 

 

master (master press) add remote_hosts in jmeter.properties

Configuration path: ... \ apache-jmeter-5.0 \ bin jmeter.properties under the path;
remote_hosts = 127.0.0.1  , add the ip and port number of the remote load machine , if you need to add more, use comma to separate;

 

 

 

Slave (remote load machine) add server_port
server_port = 1099
server.rmi.localport = 1099 in jmeter.properties

Note: The port number here can be customized, as long as it is consistent with the configuration in the main press

Enter the usr / local / apache-jmeter-5.1.1 / bin directory of the load machine and edit the jmeter.properties file

 

 

 

 

 

 

Slave (remote load machine) start Jmeter-server

Command: ./jmeter-server -Djava.rmi.server.hostname = 192.168.3.130 (the following -Djava.rmi.server.hostname = 192.168.3.130 must be added when starting, ip is the load machine ip, otherwise an error will be reported) After successful startup as shown below:

 

 

 

After the configuration is complete, restart the main press, view the remote start, you can view the configured remote load machine IP, as shown below: (the main press is best, plus the 1099 port, you must start when starting the program, jmeter.sever file)

 

 

 

Add a thread group, add a sampler-http request, take Baidu as an example, add a listener-view the result tree

 

 

 

 

 

 At this point, the configuration of distributed concurrency has been completed!

Problems encountered

Nothing is smooth, and you may encounter problems of this kind and configuration during the configuration process. The following are the problems and solutions I encountered during the configuration process.

When starting the jmeter-server service, the following error is reported:

 

 

 

Solution: Enter the usr / local / apache-jmeter-5.1.1 / bin directory of the load machine, edit the vim jmeter.properties file, there is a line like this server.rmi.ssl.disable = false Let's decide whether to enable SSL. Obviously, I don't have this on my computer, so I can't start it. Change this to server.rmi.ssl.disable = true and uncomment it.

 

 

 Can't connect to the load machine when starting remotely

 

 

 

Solution: In this case, there may be many factors, you can refer to the following steps to check one by one
(1) Whether the Jmeter-server of the remote load machine is started successfully;
(2) Whether the remote load machine is in the network state;
(3) Whether the firewall is turned off:

centos5 / 6 open and close the firewall command:

Open: service iptables start

Close: service iptables stop

centos7 open and close firewall command:

Open: systectl start firewalld.service

Close: systectl stop firewalld.service

This method is temporarily closed, effective immediately, and invalid after restart

(4) Whether the Jmeter version of the main press and the remote load machine are the same;

Summary: Xiaobian is also a beginner in performance testing. During the learning process, you will encounter various problems. Do n’t panic when you encounter problems, and do n’t ask anyone else when you come up. You have to learn to use a search engine. ask. The process of solving problems is also a learning process, which can deepen your own impression!

Guess you like

Origin www.cnblogs.com/mudingxi/p/12725932.html