Distributed Load Testing Using Apache JMeter
Learn to install, set up, and view results from the open source testing tool Apache JMeter on remote systems for distributed load testing.
Join the DZone community and get the full member experience.
Join For FreeOverview
Distributed load testing is the process of simulating a very high workload of an enormous number of users using multiple systems. As a single system cannot generate a large number of threads (users), multiple systems are used for load testing. It helps to distribute the tests and the load.
Apache JMeter, an open source testing tool, is used for load testing, performance testing, and functional testing. In JMeter, a Master-Slave configuration is used for achieving load testing. Distributed load testing is bit tricky and can provide inaccurate results if not properly configured.
In this blog, let us discuss setting up distributed testing with JMeter.
Pre-Requisites
- Download and install Apache JMeter from this link.
- Ensure that all the test machines are on the same subnet.
- Ensure that the same version of Apache JMeter is installed on all the machines.
- Ensure that the same version of Java is installed on all the machines.
- Disable firewall or designate it with a proxy supporting RMI protocol.
- Ensure the correct system configurations such as RAM, processor, and so on.
Use Case
A single Apache JMeter master instance is used to control multiple remote JMeter slave instances and to generate a large volume of load on the test application.
The distributed test environment is as follows:
Performing Distributed Load Testing
To do distributed load testing, perform the following:
Start JMeter Server in Master and Slave Systems
To start the jmeter-server.bat in both master and slave systems, perform the following:
- Click JMeter home directory --> Bin folder.
- Run the batch file – jmeter-server.bat (for Windows) or jmeter-server (for Linux) as shown in the below diagram:
Note: If you are unable to run test forms in remote machines and get the below error, check whether jmeter-server.bat file is running on the remote system:
Set IP Addresses for Slave Systems
To set the IP addresses for slave systems, perform the following:
- From the master system, open the properties file – jmeter.properties.
- Remove the current IP for remote_host entry.
For example, remove the IP address – 127.0.0.1 - Specify the IP addresses of all the Remote systems separated by commas.
For example, 192.168.0.1,192.168.0.2 as shown below:
Start Slave Systems Remotely
To remote start all the slave systems in JMeter, perform the following:
- Open JMeter in the Master machine (on which properties file are edited).
- Open your test script and Remote Start all the slave systems.
Creating the Test Plan in JMeter
To create the test plan in JMeter, perform the following:
- Create a JMeter Thread Group and mention the number of threads, loop count, and ramp-up period.
- In the Thread Group, add JMeter config element as HTTP request defaults and provide source URL and port number.
- Add HTTP Request in the test plan thread group and mention the tested URL followed by the specific path.
- Add the Duration Assertion to validate each response received within a given period.
- Add the Response Assertion to verify different segments of the response such as text (response body), document (doc, PDF), response code (200, 404), response message (description of code), and response headers.
- Add the listener to check the test plan results for all the formats.
View Results
Table View
The results can be viewed in table format as shown in the below diagram:
Response Time Graph View
The results can be viewed in the form of a chart, as shown in the below diagram:
Published at DZone with permission of Rathnadevi Manivannan. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments