All About Distributed Load Testing

Distributed load testing allows you to simulate a very high amount of users working on various systems within as well as outside your network. A single system cannot produce numerous concurrent users, so multiple systems are required for load testing.

To implement distributed load testing, you’re required to follow each step involved in it as it directly affects the cloud instance, and then the load is generated on your APIs. Using the load testing APIs, you can integrate your layout on the cloud and include visibility inside your load generators so that they can be hosted on any cloud platform.

What is JMeter?

Apache JMeter is a powerful and effective tool for analyzing and estimating the performance of different services that focus on web apps. jMeter distributed testing is mainly used to perform functional testing, load testing, and performance testing. Also, it is available free of cost. Here we have a Master-Slave configuration in JMeter that is used to perform a load test which might be a challenging task. Because, if it is not implemented correctly, then it may lead to inaccurate results.

As we discussed earlier, it works by imitating visitors to your app by allowing users to send HTTP request samplers to the webserver. After sending the requests’ response, the response data is gathered and analytical data is represented visually for all the existing concurrent users in the form of charts and reports.

This software is purely based on a Java web application that allows developers to perform load testing functions and measuring performance testing. Despite implementing performance testing, load testing, and functional testing, you can also use it to simulate a huge amount of load on a web server to test the strength under various load types.

JMeter features:

  • To perform load testing, it is freely available.
  • It provides a simple and intuitive GUI.
  • It is highly extensible.
  • To perform automated testing and functional testing of your application, you can use JMeter and its features to easily process the testing steps.
  • It can execute performance tests for various servers such as JDBC, SOAP, HTTP requests, HTTPS, etc.
  • JMeter collects the test plans in XML format and stores them so that you can create a test plan using any text editor tool.
  • It is a multi-threading framework that allows concurrent sampling by multiple threads.

Why is it important to Use JMeter for Load Testing?

Reasons to consider while using JMeter for load testing:

  • Freely available: As we discussed, JMeter is an open source tool with no licensing cost. So, it is freely available.
  • Platform Independent: JMeter is an entirely Java-based application that runs on the majority of all platforms.
  • Customizable: As an open-source tool, you can customize it whenever required.
  • Supports: Despite supporting performance testing, JMeter also supports non-functional load tests such as web service, stress testing, and distributed testing.
  • Performance testing of apps: You can use this tool to do performance testing on a variety of applications such as web applications, shell scripts, LDAP, and databases.
  • Recording and playback: JMeter offers record and playback benefits to enable the drag-and-drop feature and make your app faster and easier.
  • Community support: JMeter has large and strong community support with free plugins to help in different aspects of analysis.

Pre-Requisites

  • First, you’re required to download and install Apache JMeter.
  • All the test machines must be in the same subnet, so before moving ahead make sure to check it.
  • Same version of Apache JMeter on all the machines.
  • Same version of Java on all machines.
  • Deactivate the firewall and identify it with a proxy that maintains the RMI protocol.
  • Lastly, do not forget to check the system configurations.

Use case

A single JMeter master allows you to control various remote JMeter slave instances and create numerous loads on the performance tests application.

The distributed test environment is as follows:

Distrubuted Test Enviornment

Apache jMeter has some limitations while appropriate number of requests that can be simulated for load testing from a single machine. As an internet research, a single machine has sent 300-600 user requests to a server (depending on a type of test). That’s why distributed testing comes to the rescue. In a distributed setup there is one controller called Master and number of slaves controlled by the master. Distributed load testing can be tricky and may produce incorrect results if not configured correctly.

Let’s look at how to use multiple systems to perform stress testing. But before we start, there are a few things that need to be checked as mention below:

  • The firewalls on the systems are turned off
  • All the clients are on the same subnet
  • The server is in the same subnet if 192.x.x.x or 10.x.x.x IP addresses are used. If the server doesn’t use 192 or 10 IP address, there shouldn’t be any problems
  • Make sure jMeter can access the server
  • Make sure you use the same version of jMeter on all the systems. Mixing versions may not work correctly

Once you’ve made sure the systems are ready, it’s time to setup remote testing. The way jMeter works is 1 master controller initiates the test on multiple slave systems.

Steps to follow while performing distributed Load testing

distributed-test-environment

To perform jmeter load testing, follow the steps given below:

Step 1: Configure JMeter Server in Master and Slave Systems

At the initial stage, connect all the Master-slave PCs to the same subnet.

Start the JMeter-server.bat in master and slave systems and master to perform the following steps:

  • Go to a home directory → bin folder.
  • Run the batch file ( jmeter-server.bat (for Windows) and jmeter-server (for Linux)).

Make sure that the JMeter in master and slaves are running on the same machines. If they both are running on the same machines, Meter GUI will receive the command from the master-slave and it will send a request to a server from the same location. Run jMeter-server.bat in all slave machines (Path: jMeter\bin\jMeter-server.bat)

jmeter-server.bat

Take a Note: If you are unable to run the test plan and didn’t receive any error message, it is necessary to check whether jmeter-server.bat file is running on the remote system or not.

error initialising remote server

Step 2: Configure IP Addresses for Slave Systems

Now, set up the IP addresses for slave systems. But how? Here it is:

  • Enter the master system →  properties file → jmeter.properties.
  • Disconnect the prevailing IP for remote_host entry.
  • Open JMeter.properties file in edit mode using any software in Master Machine (e.g. notepad++)
jmeter properties
  • Add slave machine(s) IP list in remote_hosts line using comma in Master Machine (Path: jMeter\bin\JMeter.proeprties>> remote_hosts=192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, etc.)
machine(s) IP list

Step 3: Start Slave Systems Remotely

Now, set up the slave systems remotely in JMeter and perform the following operations:

  • Go to the Master machine available in JMeter (on which properties files are modified).
  • Redirect to test script and activate all the slave systems remotely.

Step 4: Create Test Plan in JMeter

After successfully completing the three steps, now you’re all ready to create the test plan using JMeter. But how? Just perform the following operations:

  • For creating a test plan in JMeter, first, you’re required to create a JMeter Thread Group in the machine. 
  • After the allocation of threads, add config elements as HTTP request defaults in the Thread Group.
  • Now, give the source URL and port number to all the config elements. 
  • Visit the test plan thread groups and add HTTP requests.
  • Consider that all the tested URLs are supported by the specific path.
  • Validate the response that we have received within the given period and add the Duration Assertion.
  • Now verify different segments of the response such as response message, response headers, document, and response code.
  • Lastly, add the listener to check the results for the formats.

Now, run distributed load testing:

  • Double click on jMeter.bat file in Master Machine (Path: jMeter\bin\jMeter.bat)
  • It displayed all slave machines IP list in jMeter>> Run menu>> Remote StartYou can run individual remote slave machines or select Remote Start All for start
run individual remote slave
  • Open Existing/Record New script In Master machine
  • Do Thread Group setting: (No. of Slave machine: 5)
  • Number of Thread (Users): 10
  • Ramp-Up Period (in seconds): 1
  • Loop Count: 1
  • When clicking on Remote Start All: Slave machines will send 50 requests in 1 second and this process will run 1 time (Calculation: 10 Users X 5 Slave = 50 Request)
slave machine log

Step 5: View Results

Test results depend on the following factors

  • Network bandwidth
  • Master and slave systems configuration including memory, processor speed
  • Configuration of the load testing tool like number of users running in parallel

Table View

The result is represented in the tabular form:

Table View

Response Time Graph View

The result is represented in the form of a chart:

Response Time Graph View

In the end…

Preparing to start your own eCommerce business or creating an eCommerce site is no big deal today.  What matters the most is that you find high traffic in your space. If not , we are capable of conducting  load tests to the upper level and integrate them with huge numbers of concurrent users. You can also run load tests locally via Apache JMeter™. However, there may be some limitations to the number of users you can run if your computer does not have enough CPU and memory. 

Once you’re all set with the systems, you can proceed further with remote testing. Wish you all the Best! 

profile-image
Vishal Shah

Vishal Shah has an extensive understanding of multiple application development frameworks and holds an upper hand with newer trends in order to strive and thrive in the dynamic market. He has nurtured his managerial growth in both technical and business aspects and gives his expertise through his blog posts.

Want to Hire Skilled Developers


    Comments

    • Leave a message...

    Related Articles
    SonarLint vs SonarQube
    SonarLint vs SonarQube
    Aug 25, 2020
    Software Testing (Quality Assurance) Strategies
    Jun 24, 2020
    The Importance of Mobile App Testing
    The Importance of Mobile App Testing
    Jul 10, 2020