Setting Up and Configuring Master-Slave Architecture in Apache JMeter

Objective

Distributed testing allows you to scale your performance tests across multiple machines. Using Master-Slave architecture, JMeter enables a central “Master” node to control one or more “Slave” nodes that generate the actual load.

This lesson will teach you to:

  • Set up and configure JMeter for distributed testing
  • Establish network communication between Master and Slaves
  • Start tests from Master and gather results from multiple Slaves
Architecture Overview
  • Master: Coordinates the test and aggregates results
  • Slave(s): Execute the test plan and generate load
Prerequisites
  • All machines (Master + Slaves) must:
    • Use same JDK and JMeter versions
    • Be on the same network
    • Have ports 1099 and 50000+ open for RMI
    • Disable firewalls or allow required ports
  • You must be able to ping each machine by hostname or IP

Step-by-Step Setup Instructions

1. Install Java and JMeter on All Machines

Refer to Lesson 1 for full setup instructions for both OS platforms.

  • Java 17 and JMeter 5.6.3 must be installed on each system.
  • Ensure that JMeter paths (JAVA_HOME, JMETER_HOME) are set.
2. Enable Network Communication
Ubuntu/Linux

sudo ufw allow 1099 sudo ufw allow 50000:51000/tcp sudo ufw reload

Windows
  • Open Windows Defender Firewall → Inbound Rules → New Rule
  • Allow TCP Ports 1099, 50000–51000
  • Allow through Private Network or Domain
3. Configure jmeter.properties on Master

Edit the file located in:

  • Linux: $JMETER_HOME/bin/jmeter.properties
  • Windows: C:\JMeter\apache-jmeter-5.6.3\bin\jmeter.properties

Find and set:

propertiesCopy

Edit

remote_hosts=192.168.1.101,192.168.1.102 # IPs of your slave nodes client.rmi.localport=50000

You can also override with -R at runtime.

4. Start JMeter in Server Mode on Slave Nodes

Run this on each Slave machine:

Ubuntu/Linux

cd $JMETER_HOME/bin ./jmeter-server

Windows

Open Command Prompt → navigate to bin folder → run:

jmeter-server.bat

Leave the window open. You should see logs indicating a listener on port 1099.

5. Start Test Execution from Master

From the Master machine, run:

jmeter -n -t my_test_plan.jmx -r

Or to run on specific hosts:

jmeter -n -t my_test_plan.jmx -R 192.168.1.101,192.168.1.102

Use -l results.jtl to save output.

Troubleshooting Tips
IssueSolution
Slaves not reachableEnsure firewall rules and network visibility (ping each machine)
“Connection refused”Confirm jmeter-server is running on Slave
RMI port errorsForce fixed client.rmi.localport and open it
Version mismatch (Java/JMeter)Ensure consistent versions across all machines

Optional Setup Scripts
Ubuntu Slave Setup Script: setup_jmeter_slave.sh
#!/bin/bash
sudo apt update && sudo apt install openjdk-17-jdk wget unzip -y

# Download and install JMeter
wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.6.3.tgz
tar -xvzf apache-jmeter-5.6.3.tgz
sudo mv apache-jmeter-5.6.3 /opt/jmeter
echo 'export JMETER_HOME=/opt/jmeter' >> ~/.bashrc
echo 'export PATH=$PATH:$JMETER_HOME/bin' >> ~/.bashrc
source ~/.bashrc

# Open required ports
sudo ufw allow 1099
sudo ufw allow 50000:51000/tcp
sudo ufw reload

echo "✅ Slave setup complete. Run 'jmeter-server' to start."


Windows Slave Instructions

Create a batch file Start-JMeter-Slave.bat:

@echo off cd "C:\JMeter\apache-jmeter-5.6.3\bin" jmeter-server.bat pause

Also ensure ports 1099, 50000–51000 are open via firewall settings.

Useful Commands
TaskCommand
Start Slavejmeter-server
Run test on all slavesjmeter -n -t test.jmx -r
Run on specific slavesjmeter -n -t test.jmx -R 192.168.1.101
View resultsUse -l results.jtl and import into GUI or Grafana

What considerations should you make when scaling a distributed test setup across 10+ slaves in different regions or clouds?

Opening Ports in Azure Windows VM for JMeter Master-Slave Setup

When using a Windows VM on Azure as a Master or Slave node, simply opening ports in the Windows Defender Firewall is not enough. You must also configure the Azure Network Security Group (NSG) attached to the VM.

Required Ports for JMeter Master-Slave
PurposePort Number
JMeter RMI Registry1099
JMeter RMI Communication50000–51000
Optional UDP comms (rare)4445

How to Open Ports in Azure VM’s Network Security Group (NSG)

Step 1: Go to Azure Portal
  1. Visit: https://portal.azure.com
  2. Navigate to Virtual Machines
  3. Click on your VM (Slave or Master)
Step 2: Locate the Network Security Group (NSG)
  1. On the left pane, click Networking
  2. Under Network Interface → Network security group, click the NSG link
Step 3: Add Inbound Rules for Required Ports
  1. In the NSG blade, select Inbound security rules
  2. Click + Add

For each port (or range), fill as below:

Rule 1: Open RMI Registry Port (1099)
  • Source: Any (or IP of Master)
  • Source port ranges: *
  • Destination: Any
  • Destination port ranges: 1099
  • Protocol: TCP
  • Action: Allow
  • Priority: e.g., 300
  • Name: Allow-JMeter-RMI-1099
Rule 2: Open RMI Communication Ports (50000–51000)
  • Destination port ranges: 50000-51000
  • Repeat other fields as above
  • Name: Allow-JMeter-RMI-Comm

💡 If you have multiple slaves, apply these NSG rules to each VM’s network interface or subnet as needed.

Step 4: Confirm Windows Firewall Allows Ports Too

On the Windows VM (Slave), allow the same ports:

  1. Open Control Panel → Windows Defender Firewall
  2. Click Advanced Settings
  3. Add Inbound Rules for:
    • TCP 1099
    • TCP 50000–51000
Final Checklist for Azure VM Setup
Configuration AreaStatus
Java + JMeter installed✅
JMeter versions match✅
remote_hosts configured on Master✅
JMeter server running on Slave✅
Ports 1099, 50000–51000 open in NSG✅
Ports open in Windows Firewall✅
Notes
  • You can restrict access to the Master IP only by changing the Source IP in the NSG rule.
  • Azure also supports scripts for NSG updates via Azure CLI or ARM templates.

About the author 

PoojaBharat

Our mission on this planet is to help you in leaving the past behind and creating the future with you, so you can live happily in the present and embark on the journey of fulfilling life.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
Subscribe to get the latest updates
>