Load Testing: Distributed JMeter Testing and Analyze Results

Load Testing: Distributed JMeter Testing & Analyze Results

Table of Contents

Load Testing: Distributed JMeter Testing and Analyze Results

What is Distributed testing?

Distributed testing in JMeter allows you to scale your performance tests by distributing the load across multiple servers. This helps simulate more realistic scenarios by running the load from different IP addresses and ensuring your application can handle peak loads efficiently. This content will teach you how to set up distributed testing with JMeter, run tests in headless mode, and analyze the results.

Load Testing: Distributed JMeter Testing and Analyze Results

Here are some steps to perform distributed testing:

Step 1: Install JMeter on All Machines

  1. Download JMeter from the official site on master and slave machines and extract it to your preferred location.
  2. Set up Java on each machine (JDK 8 or later).
  3. Verify installation by running java -version

Why Java is needed?

JMeter is a Java-based tool, so installing Java is required for it to run.

Step 2: Configure Master and Slave Machines

On each slave machine:

  1. Go to the JMeter bin directory and open jmeter.properties in a text editor (/bin/jmeter.properties).
  2. Enable the following properties for RMI communication:
    Locate the line in your configuration file that looks like this: server.rmi.ssl.disable=false
    Please change it to: server.rmi.ssl.disable=true
  3. Start the JMeter server on each slave machine by running jmeter-server

On the master machine:

  • In the jmeter.properties file, add the IP addresses of your slave machines: remote_hosts=192.168.68.111,192.168.68.115  
  • Replace 192.168.68.111 and 192.168.68.115 with your actual slave machine IPs.
  • Run the create-rmi-keystore file and answer all the questions

What does the master machine do?

The master machine controls and sends test instructions to all slave machines that run the tests.

Why RMI communication?

RMI (Remote Method Invocation) allows the master machine to communicate with the slave machines during testing. Disabling SSL ensures smoother communication.

Step 3: Create a JMeter Test Plan

  1. Open JMeter on the master machine.
  2. Create your test plan with the necessary thread groups, samplers, and listeners.
  3. Save the .jmx file (e.g., Thread Group.jmx) to a location accessible to the JMeter master node.

Why headless mode?

Running JMeter in non-GUI (headless) mode is a powerful and efficient choice, especially when running large distributed tests. This mode saves system resources and lets you focus on the test results.

Step 4: Run the Test in Headless Mode

To run the test plan on all machines remotely, follow these steps:

  1. Open the command prompt on the master machine.
  2. Navigate to the JMeter bin directory:
cd D:\Jmeter\apache-jmeter-5.6.3\bin

3. Run the distributed test using the following command:

jmeter -n -t (location of your jmeter test script) -l (location of the result file)

jmeter -n -t "C:\Test\ThreadGroup.jmx" -l "C:\JMeterResults\results.jtl" -e -o "C:\JMeterReport" -R 192.168.68.111,192.168.68.115
  • -n: Runs JMeter in non-GUI (headless) mode.
  • -t: Specifies the location of your JMeter test plan.
  • -l: Specifies where to store the results.
  • -e: Generates the dashboard report at the end of the test.
  • -o: Specifies the directory for the generated dashboard.
  • -R: Runs the test on the remote hosts (slave machines).

What to monitor?

  • Requests per second (TPS): How many requests are processed in one second?
  • Average response time: The server’s average time to respond to requests.
  • Error percentage: The percentage of requests that failed during the test.

Step 5: Monitor the Test Run

Once the test starts, you’ll see logs in the command prompt indicating the test progress. JMeter will display essential metrics such as:

  • Number of requests per second (TPS)
  • Average response time
  • Error percentage

In the command prompt, you can view summary data (success/failure, average time, throughput) during the test.

Response times over time: Helps identify if performance drops at specific points.

Transactions per second (TPS): Useful for understanding the app’s ability to handle. 

Error %: If your program is experiencing load issues, a high percentage suggests that it needs to be upgraded.  

Step 6: Generate and Analyze the Report

JMeter automatically creates an HTML report after the test is finished and the previous steps are completed. You can view this report to see the test results by following steps:

  1. Navigate to the folder where the report was generated (C:\JMeterReport).
  2. Open the index.html file in any web browser.
  3. The report will display detailed graphs and metrics:
    • Response Times Over Time: Displays how response times change during the test.
    • Transactions per Second (TPS): Displays the number of transactions handled per second.
    • Error %: Highlights any errors encountered during the test.
    • Latency vs Response Time: Compares the latency and response times to identify performance bottlenecks.

Step 7: Troubleshooting Common Issues

You can run into issues during setup or execution. The following common mistakes and solutions are provided:

  1. SSL Handshake Exception:
    • Disable SSL by setting the following in the jmeter.properties file: server.rmi.ssl.disable=true
  2. Remote Engine Not Configured:
    • Ensure the slave machines are reachable from the master machine.
    • Confirm the slave machines are running jmeter-server.
    • Check if firewall settings are blocking the RMI connection.

Following these steps, you can effectively distribute load testing across multiple machines, run tests in non-GUI mode, and analyze the results to optimize your application’s performance. Distributed testing helps simulate large-scale, real-world scenarios to ensure your application can handle peak loads.

Key Takeaways:

  • Set up both master and slave machines with JMeter and Java.
  • Run JMeter in headless mode for efficient distributed testing.
  • The JMeter HTML report analyzes performance metrics such as response times, TPS, and error rates.

With distributed testing in place, you can confidently simulate real-world load scenarios and optimize your application for performance under any condition. This approach provides a robust foundation for your application’s performance.

Share this Article To your friends

Leave a Reply

Your email address will not be published. Required fields are marked *

Our Blog

Our tips and solutions in SQA services

Future-Proof Your Software

QA Harbor's Gift To You A Free QA Consultation!

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Who are going to assist you!

Masudur Rahaman

Managing Director

Farzam Aidelkhani

Biz & Sales Lead

Zabir Ibne Mizan

Business Analyst