JMeter distributed operation
Jmeter is a Java application that consumes a large amount of CPU and memory, so when you need to emulate thousands of concurrent users, it is a bit of a problem to emulate all concurrent users with a single machine, or even cause a Java memory overflow error. In order for the JMeter tool to provide greater load capacity, JMeter has a mechanism for using multiple machines to generate loads simultaneously.
So, how is it possible to run multiple load machines at the same time? With a single JMeter client, we can control multiple remote JMeter servers, making them simultaneously stress-test the server.
By running JMeter remotely, testers can replicate tests across multiple low-end computers, simulating a larger server pressure, a JMeter client instance, theoretically controlling as many remote JMeter instances as possible, and collecting test data through them.
Deploy JMeter with 4 Linux test machines:
1. Install JDK, run JMeter be sure to install more than 1.6 versions of the JDK and configure the environment variables correctly;
2. The jmeter is packaged and placed in the specified directory, all machines expected to run JMeter are installed;
3. Define a server: Control machine controller,b, C, D server for the load machine agent;
4. First in the Bin directory to start the B, C, D server jmeter jmeter-server server, Jmeter-server Normal startup will prompt "Create remote service";
5. Prepare the test script, you can create jmx files in the Windows environment, it is best not to add listeners, because the command line starts the listener may occupy resources and have no view effect.
6. Upload the generated jmx file to the bin directory of the A server JMeter directory, and then create the Xx.jtl file in the bin directory. jtl files are used to receive test results from tests
7. Enter the bin directory into the start command, or you can use the absolute path to run the start command
./jmeter-n-T xx.jmx-r B server ip,c server ip,d server ip-l $jmeterpath/BIN/XX.JTL
Parameter description:
-N tells JMeter to run the test using Nogui mode
-T test pin name executed
-R followed by the IP address of the load machine, separated by commas
-L followed by the path and file name of the test result record, the idea that this file JMeter not create it yourself, please create it beforehand.
8. Download the Xx.jtl file to the Windows machine and analyze the test results on different listeners after the test is complete.
If you want to modify the test script, you do not have to start the script on the Windows machine Open GUI interface modification, directly edit. jmx files you can see a lot of familiar names, here is a brief introduction to a few
</elementProp>
<stringprop name= "Threadgroup.num_threads" >5</stringProp>
<stringprop name= "Threadgroup.ramp_time" >5</stringProp>
<longprop name= "Threadgroup.start_time" >1281132211000</longProp>
<longprop name= "Threadgroup.end_time" >1281132211000</longProp>
<boolprop name= "Threadgroup.scheduler" >true</boolProp>
<stringprop name= "Threadgroup.on_sample_error" >continue</stringProp>
<stringprop name= "Threadgroup.duration" >60</stringProp>
<stringprop name= "Threadgroup.delay" >5</stringProp>
</ThreadGroup>
Threadgroup.num_threads Number of threads
Threadgroup.ramp_time when all threads start to finish
Threadgroup.duration duration of the test
Under Windows, run deployment JMeter:
Under Windows Deployment and Linux are roughly the same, there are several different places, as follows:
1. In the JMeter Bin directory of the controller machine, locate the Jmeter.properties file and edit the file:
Find remote_hosts=127.0.0.1 The IP address of the machine to be the payload of the IP, separated by commas, such as 192.168.0.1:1099,192.168.0.2:1099, 1099 of which is JMeter Controller The default RMI port number for communication with the Agent;
2. Start the JMeter application Jmeter.bat on the controller machine, select the menu "Run"---> "remote Start" to start the agent separately, or you can directly select "Remote Start All" to start all agents.
JMeter distributed operation