Distributed Load Testing using Apache JMeter

Distributed Load Testing using Apache JMeter

Overview

Distributed load testing is a process of simulating very high work load of enormous number of users using multiple systems. As a single system cannot generate 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, 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 about setting up distributed testing with JMeter.

Pre-requisites

  • Download and install Apache JMeter from the following link:
    http://jmeter.apache.org/download_jmeter.cgi
  • 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 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 large volume of load on the test application.

The distributed test environment is as follows:

select

Performing Distributed Load Testing

To do distributed load testing, perform the following:

Starting 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:

select

Note: If you are unable to run test form in Remote machine and get the below error, check whether jmeter-server.bat file is running on remote system:

select

Setting 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:

select

Starting Slave Systems Remotely

To remote start all the slave systems in JMeter, perform the following:

  • Open JMeter in the Master machine (on which properties files are edited)
  • Open your test script and Remote Start all the slave systems as shown below:

select

Creating Test Plan in JMeter

To create test plan in JMeter, perform the following:

  • Create a JMeter Thread Group and mention the number of threads, loop count, and ramp-up period as shown in the below diagram:

select

  • In the Thread Group, add JMeter config element as HTTP request defaults and provide source URL and port number as shown in the below diagram:

select

  • Add HTTP Request in the test plan thread group and mention the tested URL followed by the specific path as shown in the below diagram:

select

  • 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.

select

  • Add the listener to check the test plan results for all the formats.

Viewing Results

Table View

The results can be viewed in table format as shown in the below diagram:

select

Response Time Graph View

The results can be viewed in the form of chart as shown in the below diagram:

select

Conclusion

In this blog, we discussed about setting up distributed testing with JMeter, creating test plan, and viewing results in JMeter.

References

758 Views 2 Views Today