Performance Test With JMeter Distributed Testing (Step-By-Step Guide)

Larry Deng
7 min readMay 16, 2023

Concepts of Performance Test

Performance testing is a type of software testing that evaluates responsiveness, stability, scalability, reliability, speed, and resource usage of your software and infrastructure. The goal of performance testing is to identify and eliminate performance bottlenecks in the system, ensuring that it meets the required performance criteria.

Performance testing can be performed on a variety of systems, including web applications, databases, and operating systems.

Performance testing is an important part of the software development process. By identifying and eliminating performance bottlenecks early in the development process, developers can avoid costly and time-consuming problems later on.

Here are some of the benefits of performance testing:

  • Improves the user experience by ensuring that the system is responsive and stable under load.
  • Helps to identify potential failure points in the system.
  • Can help to prevent costly and time-consuming problems later on.
  • Can help to improve the system's scalability and reliability.
  • Can help to meet performance requirements.

Types Of Performance Test

There are a few different types of performance test, you can check the table as below:

Some docs Soak Test is the same with endurance testing, capacity testing, or longevity testing.

Tools for Performance Test

Here is a list of tools you can use to do performance test:

The best tool for you will depend on your specific needs and budget. If you are looking for an open source tool that is easy to use, Apache JMeter is a good option. If you are looking for a commercial tool that is powerful and has a wide range of features, LoadRunner or NeoLoad are good options.

It is important to note that no single tool is perfect for all performance testing needs. It is often helpful to use a combination of tools to get the best results.

JMeter Distributed Testing

Now let me introduce how to do a Soak Test with JMeter distributed testing.

We need one controller node with multiple worker nodes to do the testing, if you need more workload, just increase the number of worker nodes. All the workers will connect to the target system to perform the pre-defined tests.

The workers can run in different servers, that's why it can create plenty of requests at the same time.

Test Step by Step

I will show how to do the test step by step. This is the overview of the servers.

I run the controller on my Macbook, and created two workers on Ubuntu servers. The target system is Bing, stackoverflow, QQ.

Step 1: Install JDK for controller and workers

The Apache JMeter is a Java based application, it needs a Java runtime to start up. Install JDK on Ubuntu:

sudo apt install openjdk-11-jdk

Stpe 2: Download Apache JMeter

Go the the download page and download the apache-jmeter-5.5.zip, and unzip the package:

unzip apache-jmeter-5.5.zip

We need to download for both controller and workers.

For controller, I place JMeter here:

/Users/larry/Software/apache-jmeter-5.5

For workers, I place JMeter here:

home/larry/software/apache-jmeter-5.5

Step 3: Prepare the JMX file

JMeter stores the defined test cases in .jmx file. Open the JMeter UI and write the cases:

I run the test with 8 threads, 60s ramp-up and infinite loop for 120s.

I saved the file here:

$ ls /Users/larry/Software/apache-jmeter-5.5/projects/pkslow
performance-test.jmx

Just controller need the jmx file, worker will receive the info from controller.

Step 4: Start up the workers

Start up the two workers with this command:

  • Worker 1:
$ /home/larry/software/apache-jmeter-5.5/bin/jmeter-server -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=192.168.50.171
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[192.168.50.171:41709](local),objID:[-2af2edf6:1882245cfde:-7fff, 1980465993472976097]]]
  • Worker 2:
$ /home/larry/software/apache-jmeter-5.5/bin/jmeter-server -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=192.168.50.60
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[192.168.50.60:45337](local),objID:[18489452:1882246a88b:-7fff, 4749047852254882466]]]

Note: You may hit java.rmi.RemoteException without specify the java.rmi.server.hostname.

$ ./software/apache-jmeter-5.5/bin/jmeter-server -Dserver.rmi.ssl.disable=true
May 15, 2023 5:43:16 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[127.0.1.1:33021](local),objID:[-7155c199:1881ecaf233:-7fff, -6972385484103483700]]]
Server failed to start: java.rmi.RemoteException: Cannot start. ubuntu is a loopback address.
An error occurred: Cannot start. ubuntu is a loopback address.

Step 5: Start the controller to run the test

$ cd /Users/larry/Software/apache-jmeter-5.5/

$ ./bin/jmeter -n -t projects/pkslow/performance-test.jmx -l projects/pkslow/performance-test.csv -e -o projects/pkslow/Reports -Dserver.rmi.ssl.disable=true -R 192.168.50.171,192.168.50.60
Creating summariser <summary>
Created the tree successfully using projects/pkslow/performance-test.jmx
Configuring remote engine: 192.168.50.171
Configuring remote engine: 192.168.50.60
Starting distributed test with remote engines: [192.168.50.171, 192.168.50.60] @ May 16, 2023 10:37:31 PM CST (1684247851079)
Remote engines have been started:[192.168.50.171, 192.168.50.60]
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary + 1 in 00:00:02 = 0.7/s Avg: 1260 Min: 1260 Max: 1260 Err: 0 (0.00%) Active: 2 Started: 2 Finished: 0
summary + 111 in 00:02:31 = 0.7/s Avg: 4433 Min: 41 Max: 50474 Err: 4 (3.60%) Active: 15 Started: 16 Finished: 1
summary = 112 in 00:02:33 = 0.7/s Avg: 4405 Min: 41 Max: 50474 Err: 4 (3.57%)
summary + 64 in 00:00:19 = 3.3/s Avg: 25706 Min: 62 Max: 66745 Err: 31 (48.44%) Active: 0 Started: 16 Finished: 16
summary = 176 in 00:02:52 = 1.0/s Avg: 12151 Min: 41 Max: 66745 Err: 35 (19.89%)
Tidying up remote @ May 16, 2023 10:40:24 PM CST (1684248024629)
... end of run

You can check more log in jmeter.log:

$ tail -f jmeter.log 
2023-05-16 22:40:29,956 INFO o.a.j.r.d.JsonExporter: Found data for consumer statisticsSummary in context
2023-05-16 22:40:29,957 INFO o.a.j.r.d.JsonExporter: Creating statistics for overall
2023-05-16 22:40:29,957 INFO o.a.j.r.d.JsonExporter: Creating statistics for other transactions
2023-05-16 22:40:29,957 INFO o.a.j.r.d.JsonExporter: Checking output folder
2023-05-16 22:40:29,958 INFO o.a.j.r.d.JsonExporter: Writing statistics JSON to /Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports/statistics.json
2023-05-16 22:40:30,006 INFO o.a.j.r.d.ReportGenerator: Exporting data using exporter:'html' of className:'org.apache.jmeter.report.dashboard.HtmlTemplateExporter'
2023-05-16 22:40:30,007 INFO o.a.j.r.d.HtmlTemplateExporter: Will generate dashboard in folder: /Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports
2023-05-16 22:40:30,142 INFO o.a.j.r.d.HtmlTemplateExporter: Report will be generated in: /Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports, creating folder structure
2023-05-16 22:40:30,145 INFO o.a.j.r.d.TemplateVisitor: Copying folder from '/Users/larry/Software/apache-jmeter-5.5/bin/report-template' to '/Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports', got message: /Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports, found non empty folder with following content [/Users/larry/Software/apache-jmeter-5.5/projects/pkslow/Reports/statistics.json], will be ignored
2023-05-16 22:40:30,472 INFO o.a.j.JMeter: Dashboard generated

The workers will print some simple log:

$ /home/larry/software/apache-jmeter-5.5/bin/jmeter-server -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=192.168.50.171
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[192.168.50.171:44621](local),objID:[4d13369d:18824fd059a:-7fff, 2287886479123818682]]]
Starting the test on host 192.168.50.171 @ 2023 May 16 22:37:31 HKT (1684247851980)
Warning: Nashorn engine is planned to be removed from a future JDK release
Finished the test on host 192.168.50.171 @ 2023 May 16 22:40:24 HKT (1684248024679)

Step 6: result and report

After the whole test completed, you can find the result and report:

$ ls -l /Users/larry/Software/apache-jmeter-5.5/projects/pkslow/
total 72
drwxr-xr-x 6 larry staff 192 May 16 22:40 Reports
-rw-r--r-- 1 larry staff 23472 May 16 22:40 performance-test.csv
-rw-r--r-- 1 larry staff 10593 May 16 09:50 performance-test.jmx

We can open the index.html in the Reports folder:

Other tips

Change the worker server port

For workers, the default server port is 1099, you can change the port in properties file or command line parameter:

$ /home/larry/software/apache-jmeter-5.5/bin/jmeter-server -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=192.168.50.60 -Dserver_port=1984

So the controller need to change the port:

$ ./bin/jmeter -n -t projects/pkslow/performance-test.jmx -l projects/pkslow/performance-test.csv -e -o projects/pkslow/Reports -Dserver.rmi.ssl.disable=true -R 192.168.50.171:1984,192.168.50.60:1984

What's more, with different port, you can start up more workers in one server.

run command with nohup

As the test may take a long time to complete, it's better run all the command with nohup:

$ nohup ./bin/jmeter -n -t projects/pkslow/performance-test.jmx -l projects/pkslow/performance-test.csv -e -o projects/pkslow/Reports -Dserver.rmi.ssl.disable=true -R 192.168.50.171:1984,192.168.50.60:1984 &
[1] 81248

Save the result and resport with datetime

$ nohup ./bin/jmeter -n -t projects/pkslow/performance-test.jmx -l projects/pkslow/performance-test."$(date +%F.%T)".csv -e -o projects/pkslow/Reports-"$(date +%F.%T)" -Dserver.rmi.ssl.disable=true -R 192.168.50.171:1984,192.168.50.60:1984 &

Summary

Performance test is quite important and Apache JMeter can help us. Hope this article help you to understand and set up the remote test.

Please find the jmx code in: LarryDpk/pkslow-samples

--

--