Distributed Testing in JMeter: Many Machines, One Test

Distributed Testing in JMeter: Many Machines, One Test

A beginner-friendly, book-length guide to the master-slave setup in JMeter: one controller that conducts the test and many agents that generate the load, with every moving part explained in plain words.

Imagine you want to find out whether a stadium can handle fifty thousand fans entering at once. You could hire one very strong person and ask him to pretend to be fifty thousand fans, but he would collapse long before the gates did, and you would learn nothing about the stadium. A sensible organiser hires a coordinator and a hundred stewards, hands each steward a few hundred volunteers, and lets the coordinator blow one whistle so everybody starts together. Distributed testing in JMeter is exactly that arrangement. This guide explains, from zero, how the coordinator and the stewards talk to each other, how to set them up, how to feed them data, how to collect what they report, and how to avoid the mistakes that waste a whole afternoon.

1What Distributed Testing Is and Why It Exists

One computer can only pretend to be so many users before it becomes the slowest part of the test.

The plain meaning

JMeter is a tool that imitates many users visiting a system so that you can measure how the system behaves under crowd pressure. Each imitation user is a thread, a small independent worker inside the program. A computer has a limited amount of processor power, memory and network capacity, so it can run only so many threads before it starts to struggle. Distributed testing means using several computers together, so the crowd you create is the sum of what all of them can produce.

Why a single machine eventually fails you

When the machine that generates load runs out of processor or memory, it slows down. Slow generation looks like slow response, because the clock keeps running while the machine is too busy to send the next request or read the last reply. The numbers then describe the weakness of your test computer, not the weakness of the system you meant to examine. Spreading the work across several machines keeps each of them comfortable, so the timings stay honest.

Simple Analogy

Think of a restaurant that wants to know how fast its kitchen can cook when a hundred tables order at once. If one waiter plays all hundred customers, the waiter becomes the bottleneck and the kitchen looks lazy. With ten waiters playing ten customers each, the kitchen is the only thing under test.

Other reasons to spread the load

Besides raw capacity, there is a second reason: the network. A single machine has a single network card and a single route to the system under test. Many real users come from many places and many routes. Several generators, possibly in different locations, can show whether the network path itself is a limit, and can imitate geographic spread more truthfully.

1
controller that conducts the test
Many
agents that generate the load
1
combined result for the whole crowd
i
Remember

Distribution is a tool for honest measurement, not a way to make numbers bigger for their own sake. If one well-tuned machine can produce the load you need while staying relaxed, you do not need more.

2Core Concepts and Vocabulary

A handful of words carry the whole subject; learn them once and everything else follows.

Term 1

Controller (Master)

The machine where you open or start the test. It sends the plan to the agents, tells them when to begin and stop, and collects their results. Older material calls it the master.

Term 2

Agent (Slave, Remote Engine)

A machine that waits for instructions and then generates load. It runs a small background program that listens for the controller. Older material calls it a slave or a server.

Term 3

Remote Procedure Call

The method by which one program asks another program on a different machine to do something, as if the other program were local. The controller uses this to command agents.

Term 4

Test Plan

The saved description of what the virtual users do. The same plan is sent to every agent, and each agent follows it independently.

Term 5

Thread

One imitation user. A thread group sets how many threads run, and each agent runs its own full set of threads.

Term 6

Load Generator

Any machine that produces test traffic. In a distributed setup, each agent is a load generator, and the controller usually should not be one.

Term 7

Sample Result

The record of one request: what was asked, how long the answer took, whether it succeeded. Agents send these back to the controller.

Term 8

System Under Test

The website, service or database that you are examining. It is the target of all the traffic from all the agents.

Simple Analogy

A film director (the controller) holds the script (the test plan) and sends identical copies to many camera crews (the agents). Each crew shoots its own footage at the same time, and the director gathers all the footage into one final film (the combined result).

!
Common Misconception

The words master and slave are older names used in many guides and in the tool itself; newer documents say controller and agent. They describe the same roles. Use whichever your team understands, but keep the roles clear.

3Architecture and Components

The shape is a simple star: one centre, many arms, and one target.

Three groups of machines

A distributed setup has three groups. The first is the controller, a single machine used by the tester. The second is the group of agents, each running a waiting program. The third is the system under test, which receives traffic from the agents directly. This last point surprises many beginners: the load does not pass through the controller. The controller only sends instructions and receives reports. The traffic itself flows from each agent straight to the target.

flowchart TD
  C[Controller machine] -->|plan and commands| A1[Agent 1]
  C -->|plan and commands| A2[Agent 2]
  C -->|plan and commands| A3[Agent 3]
  A1 -->|results| C
  A2 -->|results| C
  A3 -->|results| C
  A1 ==>|test traffic| T[System under test]
  A2 ==>|test traffic| T
  A3 ==>|test traffic| T
        
FIG 1 — Commands flow out, results flow back, and load flows to the target

Inside each machine

The controller holds the test plan file, the program interface or command line, and the listeners that show results. Each agent holds the same tool installation and a small background service that waits for orders. When an order arrives, the agent starts its own copy of the test engine, runs the threads, and streams sample results back.

ComponentLives OnJob
Test plan fileController (copied to agents at start)Defines what users do
Agent serviceEach agentWaits for controller, starts and stops local engine
Test engineEach agentRuns threads and sends requests
Result listenersControllerReceive and show combined results
Data filesEach agent (must exist locally)Feed users with accounts and values
Property settingsController and each agentControl hosts, ports, security, result sending
Simple Analogy

A radio network has one dispatcher at the base and many taxis in the city. The dispatcher speaks to the taxis, and the taxis report back, but the passengers ride in the taxis, not through the dispatcher’s desk. Likewise the load runs on the agents, and the controller only dispatches.

i
Remember

Because traffic goes agent to target, the network path that matters for load is between each agent and the system under test, not between the controller and anything else.

4How It Works Inside: The Conversation

The controller and the agents hold a short, structured conversation at the beginning, the middle and the end.

The opening

Each agent starts a background service that listens on a network port. When the tester starts a distributed run, the controller looks up the list of agents, connects to each one, and sends the entire test plan across the network. Each agent receives the plan, prepares its own engine, and then waits for the go signal. The controller sends that signal to every agent in quick succession so the crowd forms at nearly the same moment.

The middle

While the test runs, each agent follows the plan independently. It does not ask the controller for permission before each request. It simply works, and periodically sends batches of sample results back to the controller so the listeners there can show progress. If the controller disappears, the agents continue until their plan ends, though their results have nowhere to go.

The ending

When the plan finishes, or the tester presses stop, the controller tells the agents to stop their engines. Each agent ends its threads, sends any remaining results, and returns to waiting for the next order. Optionally the controller can also tell the background services to exit completely.

sequenceDiagram
  participant T as Tester
  participant C as Controller
  participant A as Agent
  participant S as System under test
  T->>C: Start distributed run
  C->>A: Connect and send test plan
  A-->>C: Plan received and ready
  C->>A: Start signal
  A->>S: Requests from virtual users
  S-->>A: Responses
  A-->>C: Batches of sample results
  T->>C: Stop or plan ends
  C->>A: Stop engine
  A-->>C: Final results
        
FIG 2 — The conversation between controller, agent and target
Simple Analogy

Picture a conductor handing the same sheet music to every musician, waiting until all are ready, raising the baton once, and lowering it at the end. Each musician plays on their own instrument without asking the conductor before every note, yet the music holds together because of the shared start.

!
Common Misconception

The start signal is not perfectly simultaneous. It reaches agents one after another, over a network, so there can be small differences in start time. For most load tests these are negligible; for very precise coordination they are worth knowing about.

5The Multiplication Rule

The most common beginner surprise is the size of the crowd that appears.

Every agent runs the whole plan

The controller does not divide the plan into slices. Each agent receives the complete plan and runs it in full. If the thread group says one hundred users, and you have five agents, the total crowd is five hundred users. Loop counts, durations and rate controls inside the plan are also applied on every agent separately.

Simple Analogy

If a teacher gives every classroom the same worksheet and says each class must complete thirty questions, five classrooms produce one hundred and fifty answered questions, not thirty. The worksheet was not divided; it was copied.

Planning the numbers

To reach a target crowd, divide the target by the number of agents and put the result in the plan. If you need one thousand users across four agents, set the group to two hundred and fifty. If the agents differ in power, you may prefer a plan that reads the thread count from a property, so each agent can be given its own share at start time.

Plan SettingEffect with Several Agents
Number of threadsMultiplied by agent count
Loop countEach agent runs its own loops, so total requests multiply
Ramp-up periodApplied on every agent at the same time, so users arrive in parallel streams
DurationSame on each agent; test ends when the last agent ends
Throughput timer (target rate)Applied per agent; the total rate multiplies
Data file readingEach agent reads its own copy, from its own start
!
Common Mistake

Taking a plan tuned for a single machine and running it on ten agents without changing the thread count. The system under test then receives ten times the intended load, and sometimes falls over for reasons that have nothing to do with the question being asked.

6Knowing When You Really Need It

Extra machines add effort, so use them when the evidence calls for them.

Signs that a single generator is overloaded

Watch the generator while the test runs. If the processor stays near its ceiling for long stretches, if memory climbs towards its limit and garbage collection pauses grow, or if the network card approaches its bandwidth, the machine is stressed. Another sign is that response times rise as you add users on the generator but the system under test shows plenty of spare capacity in its own monitoring. A third sign is that the achieved request rate stops growing even though you keep adding threads.

1

Tune one machine first

Run in command-line mode, remove result trees, trim saved data, and give the program an appropriate memory setting. Many tests need nothing more.

2

Measure the generator

Watch processor, memory, network and pause times on the generator while the test runs.

3

Find the single-machine ceiling

Raise the crowd until the generator becomes the limit, and note the comfortable number just below it.

4

Divide the target by that number

The result, rounded up with some spare room, is the number of agents you need.

Simple Analogy

Before hiring more movers, first check whether your single mover is using a trolley. If he still cannot carry the furniture in a day even with a trolley, you hire more. Hiring a crew for a job one person could do with a trolley is wasteful.

i
Remember

Distribution also helps when you need load from several locations. In that case the number of agents is set by geography as well as by capacity.

7Prerequisites: Getting the Machines Ready

Most distributed failures are caused by small mismatches between machines, not by the tool.

Rule 1

Same tool version

Controller and agents must run the same release of the tool. Different versions can disagree about how to talk to each other or how to read the plan.

Rule 2

Same Java version family

The tool runs on Java. Keep the Java release the same, or at least compatible, on every machine, to avoid confusing communication errors.

Rule 3

Same plugins

If the plan uses extra plugins, every agent must have the same plugin files installed. A missing plugin on an agent stops the plan from loading there.

Rule 4

Same supporting files

Data files, certificates and scripts that the plan refers to must be present on every agent, at the paths the plan expects.

Rule 5

Synchronised clocks

Machine clocks should agree, using a standard network time service, so timestamps in combined results line up.

Rule 6

Reachable network

The controller must be able to reach each agent and each agent must be able to reach the controller to send results back.

Simple Analogy

Before a relay team races, every runner must have the same type of baton, the same rules and watches that show the same time. If one runner arrives with a different baton or a watch ten minutes off, the race is spoiled before the starter fires.

!
Common Mistake

Upgrading the controller to a newer release while leaving agents untouched. The agents appear to start, but the plan fails to load or behaves strangely, and the error messages seldom mention the version mismatch.

8Preparing an Agent

An agent is simply an installed copy of the tool with its waiting service switched on.

The steps in words

1

Install Java and the tool

Place the same release of the tool on the machine and confirm that Java is available.

2

Install plugins and supporting files

Copy any plugin files into the extension folder, and put data files and certificates in the expected locations.

3

Prepare security material

The communication between controller and agents is secured by default using a key store file. Place the matching key store on every machine, or follow the documented way to disable it only inside a closed, trusted network.

4

Tell the agent its own address

On machines with several network addresses, or inside containers and cloud machines, set the address the agent announces, so the controller can reach it back.

5

Start the agent service

Run the provided agent start script. It keeps running, waiting for orders, and prints a message when it is ready.

6

Open the port

Allow the controller to reach the agent through the machine’s firewall on the port the service uses.

Simple Analogy

Preparing an agent is like switching on a shop’s open sign and unlocking the door. The shop stays open and waits, and only starts selling when a customer walks in. The agent stays running and waits, and only starts testing when the controller calls.

i
Remember

Start with one agent on the same network as the controller and make that work. Adding the second, third and tenth is then a matter of repetition rather than discovery.

9Preparing the Controller

The controller needs to know who the agents are and how to talk to them.

The list of agents

The tool has a settings file with a property that holds a comma-separated list of agent addresses. Entering the addresses there lets the controller start every agent with one command or one menu click. You may also supply the list at the moment you start, which overrides the file and lets you choose a subset for a particular run.

Matching security and settings

The controller must hold the same key store as the agents when secure communication is used. It also needs the same settings for any special ports. Where the controller sits behind a firewall, or on a machine with several network cards, it needs to announce the address that agents can use to reach it back with results.

Leaving the controller light

In a distributed run, the controller does not generate the load unless you specifically arrange it. That is a feature: its resources are then free to receive and show results from all agents. Keep the controller well supplied with memory, and keep the number of listeners attached to it modest.

Simple Analogy

The controller is like an air traffic tower. It needs a complete list of the planes it directs, a working radio on the right frequency and a clear head. It does not fly a plane while directing the others.

!
Common Mistake

Listing agent addresses with spaces, typing a name that does not resolve, or forgetting one agent in the list. The controller then reports that it cannot reach an agent, or silently runs with fewer machines than you intended.

10Starting a Distributed Test

You can start from the graphical window or from the command line; both do the same conversation.

From the graphical window

In the window, a Run menu offers a remote start option for all agents, one for a single named agent, and matching stop and shutdown options. This route is useful while you are learning and checking that every agent responds. It is not the route for large measured runs, because the window consumes memory and processing on the controller.

From the command line

For serious runs, start the controller in non-graphical mode with the plan file and a result file. Add the option that says to start all configured agents, or the option that names specific agents. Another option asks the tool to shut the agent services down when the test ends. A separate option sets a property on all agents at once, which is how you pass values such as thread counts to every machine.

IntentIdea in Words
Run on every configured agentUse the remote-start-all option
Run on selected agents onlyName the agents explicitly in the command
Pass a value to every agentUse the global property option
Stop agents when finishedUse the exit-remote-servers option
Save combined resultsGive a result file name on the controller
Simple Analogy

Starting from the window is like giving instructions by walking round the office and talking to each person. Starting from the command line is like sending one clear memo to everyone. The memo is quicker, repeatable and consumes less of the manager’s day.

i
Remember

Do a very small distributed run first, such as one user per agent for a minute. Confirm every agent connected and produced results before you scale to the real crowd.

11Networks, Ports and Firewalls

Most “it just will not connect” stories end in a closed door somewhere between machines.

Two directions of conversation

The controller must reach each agent to send the plan and commands. Each agent must also reach the controller to send results back. Both directions need open doors. A firewall that allows the first but blocks the second produces the confusing situation where the test appears to start and then no results arrive.

Fixed and random ports

The communication method uses a registry port, which by default is a well-known number, and then additional ports for the actual objects exchanged. By default those additional ports are chosen at random, which is awkward for firewalls that need exact rules. The tool lets you pin these to fixed numbers through settings, on both the agent side and the controller side, so that the firewall can allow precisely those ports and nothing else.

Simple Analogy

Think of an office building where the receptionist’s desk is always at the front, but meeting rooms are assigned randomly each day. A security guard cannot pre-approve visitors unless the rooms are fixed. Pinning the ports is like fixing the meeting rooms so the guard can write a clear list.

DirectionPurposeWhat Must Be Open
Controller to agentSend plan, start, stopAgent registry port and agent object port
Agent to controllerSend results backController callback port
Agent to system under testThe test trafficWhatever ports the target service uses
All machines to time serviceClock agreementTime protocol port

Addresses that travel

A machine with several network addresses may announce the wrong one. Containers and cloud machines have private addresses inside and public addresses outside. If an agent announces an address the controller cannot reach, the first connection works but later calls fail. Each machine should be told the address that other machines should use to find it.

!
Common Mistake

Putting the controller on a home or office network behind address translation while agents sit in a cloud network. The agents cannot call back to the controller, so results never arrive. Place the controller inside the same network as the agents, or use a secure tunnel.

12Security of the Controller-Agent Channel

An agent obeys whoever speaks to it correctly, so the channel must be protected.

Why this matters

An agent is a program that accepts instructions from the network and runs a test plan, which can contain scripts. If anyone on the network could send it a plan, they could make it run arbitrary actions. For this reason the tool secures the channel by default with encrypted communication that uses a shared key store file, and recent releases expect that file to exist.

The key store idea

A key store is a file that holds the identity material used for encryption. A helper script supplied with the tool creates one. You then copy that same file to the controller and to every agent. Machines that hold the file can talk to each other; machines without it are refused. Treat the file with the same care as a password.

Simple Analogy

It is a secret handshake that every team member has learned. A stranger walking up to the door cannot give the handshake and is turned away. Losing the handshake to a stranger means anyone can walk in, so you guard it.

Turning it off

The tool allows the secure channel to be disabled through a setting, which is sometimes done in a small closed laboratory network to avoid certificate work. Do this only where the network is isolated and trusted, and never on a network others can reach. Both sides must agree: if one end is secure and the other is not, they cannot connect.

i
Remember

Agents should live on a private network or behind restricted firewall rules that allow only the controller to reach them. Security of the channel and restriction of the network together give a layered defence.

!
Common Mistake

Generating a fresh key store separately on each machine. Every file is different, so no two machines trust each other, and the connection fails with a message about security that is easy to misread.

13Properties: Local, Remote and Global

Settings can live on the controller, on an agent, or be pushed to all agents at once.

Three places a setting can live

A setting in the controller’s settings file affects only the controller. A setting in an agent’s settings file affects only that agent. A setting supplied with the global option on the controller’s command line is sent to every agent at start. Knowing which of the three you need avoids many puzzles, such as why a thread count changed on the controller but not on the agents.

Where SetWho Sees ItTypical Use
Controller settings fileController onlyList of agents, result handling
Agent settings fileThat agent onlyPorts, announced address, machine-specific paths
Controller local property optionController onlyOne-off controller behaviour
Controller global property optionAll agents, at startThread count, duration, target host, test mode
Agent-specific value in a data file or planThat agentDifferent accounts or slices per machine

Plans that read properties

A well-built plan reads its main numbers from properties through the property function, with sensible defaults. The tester then changes the crowd size, the duration, or the target address without editing the plan file. In a distributed run, the global option carries those numbers to every agent in one step.

Simple Analogy

Think of a company with a head-office notice board, individual desk notes and a group email. The notice board is for head office only, desk notes are private, and the group email reaches everyone. You choose the channel according to who must read the message.

i
Remember

Properties are read when the plan starts. Changing a property on an agent while a test is running will not alter the running test.

14Data Files Across Many Agents

A shared plan with separate files on each machine is the source of both power and mistakes.

The files must be on the agents

When the controller sends the plan, it sends the plan only. It does not send the data files the plan refers to, such as lists of user names and passwords. Each agent reads the file from its own disk at the path written in the plan. If the file is missing on an agent, the test elements that use it fail there, though they work on the controller.

The duplicate-data trap

If every agent holds an identical copy of the file and reads from the top, then agent one and agent two both begin with the same first account at the same moment. Many systems reject two simultaneous logins of one account, or lock it, so the test then measures login failures, not capacity. The cure is to give each agent its own slice of the data.

Option 1

Split the file

Divide the master list into equal parts, one per agent, and store each part under the same file name on its agent. The plan stays identical.

Option 2

Name files per agent

Use a property or variable in the file name, so each agent loads its own file, supplied with its own setting.

Option 3

Generate unique values

Create user names from a counter combined with a machine-specific prefix, so no two machines produce the same value.

Option 4

Use enough accounts

Ensure the total pool is large enough for all threads of all agents, without reusing accounts during the run.

Simple Analogy

If ten ticket checkers each receive a copy of the same guest list and each starts reading from the first name, ten people will try to enter as the same guest. Cutting the list into ten sections and giving each checker one section avoids the confusion.

!
Common Mistake

Copying the data file to agents while the path in the plan is written for the controller’s own folder layout, such as a drive letter that exists on only one machine. Use relative paths or the same folder layout on every machine.

15How Results Come Back: Sending Modes

Every sample an agent produces must travel to the controller, and how it travels changes the load on both.

Why this matters

At high rates, agents produce thousands of sample results per second. Sending each one individually across the network, at the moment it is created, can slow the agent and flood the controller. The tool offers several sending modes that trade immediacy for efficiency.

ModeIdeaTrade-Off
StandardSend each result as it happensMost immediate, most network and controller load
BatchCollect a group and send togetherLess chatter, slightly delayed view
StatisticalSend summaries instead of every sampleLow load, less detail per request
StrippedRemove bulky response data before sendingSmaller messages, no response text on the controller
Stripped batchRemove bulky data and send in groupsA popular compromise for large runs
AsynchronousSend in the background using a queueAgent not slowed by network, but memory used if queue grows
Disk storeWrite to local disk and send laterSafe for volume, with extra disk work
Simple Analogy

A courier can deliver each letter the moment it is written, or collect letters into a bag and deliver once an hour. The first gets news there fast but clogs the roads; the second is calmer and cheaper. For very heavy mail, the bag wins.

i
Remember

The sending mode is chosen by a setting that is applied on the agent side or passed globally. Confirm the effective value on each agent, since a different mode on one machine causes uneven behaviour.

!
Common Mistake

Stripping response data and then expecting the controller’s tree view to show response bodies. They have been removed on purpose; debug with a small single-machine run instead.

16The Controller as a Bottleneck

The conductor can be overwhelmed by the sheer volume of reports from the players.

How it happens

All results from all agents are funnelled into the single controller. Ten agents, each producing a thousand results every second, send ten thousand records per second towards one machine. If the controller must also draw tables and graphs, it may fall behind. When it falls behind, agents may slow down as their send queues fill, and the combined result becomes late and incomplete.

flowchart LR
  A1[Agent 1 results] --> Q[Controller intake]
  A2[Agent 2 results] --> Q
  A3[Agent 3 results] --> Q
  A4[Agent N results] --> Q
  Q --> L{Listeners and writing}
  L -->|too heavy| X[Controller falls behind]
  L -->|light| Y[Compact result file]
        
FIG 3 — All results converge on one controller

Keeping it healthy

1

Use the command line

Avoid the graphical window for large runs.

2

Use batch or stripped modes

Reduce the volume and frequency of messages.

3

Write to a file only

Skip live listeners that store every sample in memory, and analyse the result file or a report afterwards.

4

Give it memory and a good disk

Provide enough memory and fast storage on the controller.

Simple Analogy

Imagine a single receptionist who must sign for parcels from ten delivery vans at once while also painting a mural of each parcel. She will fall behind. If she only signs and stacks the parcels, and someone else paints later, the queue disappears.

17Time, Ramp-Up and Coordination

When many machines act together, the clock becomes part of the design.

Clocks that must agree

Every sample is stamped with the time on the agent that produced it. When results from several agents are combined, the stamps are merged on one timeline. If one agent’s clock is minutes off, its results appear in the wrong place, and charts of throughput or response over time look strange. A network time service on every machine fixes this cheaply.

Ramp-up is per agent

A ramp-up period tells each group to bring in its users gradually. With several agents, each ramps up independently, so the total crowd grows as the sum of several staircases. That is usually what you want, but if agents start at slightly different moments, the combined shape is a little jagged. Allow a settling period before you begin reading measurements.

Staggered starts and uneven agents

Agents with unequal power should receive unequal shares, or the weaker agent finishes late and distorts the end of the run. If you need controlled timing, such as all users reaching a certain step together, use a synchronising element in the plan, and remember that it coordinates threads within one agent, not between agents.

Simple Analogy

If several choirs rehearse in different towns and send recordings to be merged, the recordings only line up if every town used the same clock. A choir with a slow clock would sing in the wrong place of the final song.

i
Remember

Judge results from the steady period of the run, after all agents have finished ramping up and before any begin winding down.

!
Common Misconception

Assuming a timer that waits for a number of users works across all agents. It counts only users on its own agent, so a rendezvous across machines needs a different design.

18Sizing: How Many Agents and How Strong

Capacity planning for the load generators is its own small discipline.

Three pieces of arithmetic

First, find how many users one agent can run comfortably for your particular plan. A plan with big responses, heavy scripts or encrypted traffic is much more demanding than a plan with tiny requests. Second, divide the total users you need by that comfortable number, then round up and add spare room. Third, check that the combined network traffic does not exceed the limits of the network path between the agents and the target.

Measure
comfortable users on one agent
Divide
target crowd by that number
Add
spare room for safety

What makes an agent heavier

Factor 1

Response size

Large replies take network and memory to receive and to inspect.

Factor 2

Encrypted traffic

Secure connections cost processor time, especially when each user sets up a new one.

Factor 3

Extractors and scripts

Every extractor and script runs on the agent for every sample.

Factor 4

Think time

Longer pauses between requests lighten the burden per user, so more users fit on one machine.

Simple Analogy

If you plan a hiking trip, you work out how much weight one porter can carry on the actual terrain, not on a flat road. Steeper hills mean more porters. The weight and the terrain are your plan and your protocol.

i
Remember

Prefer several moderate agents to a few huge ones. Failure of one machine then costs a small share of the crowd, and each machine runs with comfortable room.

19The Alternative: Independent Runs and Merged Results

The built-in controller-agent setup is not the only way to use many machines.

What the alternative looks like

Instead of one controller commanding many agents, you start the same plan separately on each machine, in non-graphical mode, using an ordinary script or scheduling tool. Each machine writes its own result file. After the run, you merge the result files into one and analyse them together. There is no persistent connection between machines during the test.

Advantages

  • No network channel to configure, secure or open in firewalls
  • No controller bottleneck during the run
  • A failure of one machine does not interfere with the others
  • Works naturally with scheduling and automation tools

Disadvantages / Trade-offs

  • No single start button, so starts may differ by seconds
  • No live combined view while the test runs
  • Results must be collected and merged afterwards
  • Settings must be passed to each machine separately
Simple Analogy

It is like sending the same survey to ten offices by post and combining the filled forms at the end, instead of phoning each office live and entering answers as they speak. The postal route is simpler and sturdier, but you wait to see the full picture.

Choosing between them

The built-in method is attractive when you want one trigger and a live combined view and the network is simple. The independent method is attractive in locked-down networks, in cloud setups with orchestration tools, and for very large runs where the controller would be overloaded. Many teams use the independent method for their serious runs and the built-in method for quick experiments.

i
Remember

When you merge result files, make sure every machine used the same column settings and the same time standard, or the combined file will be confusing.

20Diagnosing Distributed Problems

Symptoms usually point at one of a few causes; learn the map and troubleshooting becomes calm.

SymptomLikely CauseFirst Check
Controller cannot connect to an agentService not running, wrong address, port closedIs the agent service started and reachable from the controller?
Connection works, then fails mid-startAgent announced an unreachable addressThe address setting on the agent
Secure-channel or security error at connectDifferent or missing key storeSame key store file everywhere?
Test starts but no results appearAgents cannot call back to the controllerController address and callback port, firewall direction
Plan fails to load on one agentMissing plugin or version mismatchCompare versions and extension folders
Errors only on agents, not on controllerMissing data file or wrong pathFile location on each agent
Far more load than expectedThread count not divided by agentsTotal equals threads times agents
Results arrive very lateController overloaded or standard mode at high rateSending mode and controller resources
One agent shows odd timingsThat machine is overloaded or has a wrong clockProcessor, memory and time on that machine
Simple Analogy

If a team radio network fails, you check in order: is the radio on, is it tuned to the right channel, is the base station listening. You do not rebuild the whole network. Moving along the chain from the nearest link to the farthest finds the break fast.

A calm routine

1

Reduce to one agent

Run with one agent and one user, and make it succeed.

2

Read the agent logs

Each agent keeps its own log file; look there for errors that never reach the controller.

3

Add agents one at a time

Add the next agent, rerun the small test, and see which addition breaks.

4

Scale the crowd last

Increase users only after connectivity and results are known to be sound.

i
Remember

The most valuable evidence is often in the agent’s own log, not in the controller’s window. Make a habit of reading both.

21Cloud Machines, Containers and Disposable Agents

Agents are an ideal fit for machines that you create for a test and delete afterwards.

Why the cloud suits agents

An agent holds nothing precious. It is an installed tool, a key store, some supporting files and a waiting service. You can capture all of that as a machine image or a container image, start twenty copies for an afternoon, and delete them when the test is over. You pay only for the hours used, and you can place agents in regions near your real users.

Simple Analogy

It is like renting extra stewards for a single big match instead of employing them all year. They arrive trained, do their shift and go home. The stadium never carries a permanent payroll for the busiest day.

Things that need care

Care 1

Addresses

Containers and cloud machines have inside and outside addresses; each agent must announce the one that the controller can reach.

Care 2

Agent list

Addresses change with every new machine, so the list of agents must be produced fresh for each run, ideally by automation.

Care 3

Network rules

Security groups or network policies must allow the ports in both directions between controller and agents.

Care 4

Cleanup

Forgotten machines keep costing money. Tag them clearly and remove them as part of the end-of-test routine.

i
Remember

Where orchestration platforms are used, many teams skip the built-in controller link and launch independent runs in containers, collecting results into shared storage. Both approaches are valid; choose by network and tooling.

22Monitoring the Agents and the Target

You cannot trust a result without knowing the health of the machines that produced it.

Two things to watch

Watch the agents to prove that the test machines were comfortable. Watch the system under test to learn how it behaved. Without the first, you cannot tell whether slowness was real. Without the second, you will know that responses were slow but not why.

What to WatchWhereWhat It Tells You
Processor useEach agentSustained high values mean the agent is the limit
Memory and pause timesEach agent and controllerRising memory and long pauses distort timing
Network throughputEach agent and target network pathNear-limit values mean the pipe is the bottleneck
Open connections and errorsAgentsConnection failures at the generator end
Result arrival rateControllerLag means controller or network is overloaded
Application and database healthSystem under testThe real answer to the test question
Simple Analogy

When checking how well a bridge carries traffic, you also check that your test lorries were not themselves broken down. A slow crossing tells nothing unless you know the lorries were healthy.

Recording the evidence

Keep monitoring data for the agents next to the result files for each run. When someone later questions a result, you can show that every agent stayed below a comfortable level, which makes the result defensible.

!
Common Mistake

Looking only at the target’s dashboards. If an agent was saturated, the target never saw the intended load, and a good-looking target can hide a failed test.

23Stopping, Shutting Down and Cleaning Up

A test is only finished when the machines are back in a known state.

Stop versus shutdown

Stopping a test tells the agents to end their threads, finishing current requests gracefully where it can. Shutting down is a gentler request still, asking threads to complete their present iteration. Exiting the agent services entirely is a third action, which closes the waiting program on each agent. Knowing the difference avoids both abrupt endings and agents left running by accident.

1

Let the plan end naturally

Where possible, use a duration or loop count so every agent ends by itself.

2

Wait for final results

Allow time for the last batches of results to reach the controller before closing it.

3

Collect agent logs and files

Copy the agents’ logs and any local result files before machines are removed.

4

Stop agent services

Exit the services or remove the machines so nothing keeps listening on the network.

5

Reset the system under test

Clear or restore any data created by the test, so the next run starts clean.

Simple Analogy

After a catering event, the staff do not simply walk out. They collect the plates, switch off the ovens, lock the doors and return the hall as they found it. A test that leaves processes and data behind is a hall left in a mess.

!
Common Mistake

Closing the controller the moment the last request ends. Results still in transit are lost, and the last seconds of the run are missing from the final file.

24Security and Responsibility

A crowd of agents is a powerful tool that must be pointed carefully.

Protect the agents

Agents run test plans on request, so keep them off public networks, restrict who can reach them, keep the key store private and use the secure channel. When machines are rented in the cloud, apply the same rules you apply to any server: patched software, minimal open ports and removal after use.

Protect the target and the neighbours

Many agents together can produce a flood. Do not aim them at systems you do not own or have no permission to test. A shared environment may host other teams, so schedule heavy tests and tell the owners. Cloud providers and third-party services often require advance notice or forbid load testing at all.

Protect the data

Result files and logs may contain addresses, user names and response fragments. Store them securely and delete them when no longer needed. Use test accounts, never real customer accounts, and keep credentials out of shared plan files by supplying them through data files or properties.

Simple Analogy

A fire-fighting crane can save a building or flatten one. Having the key to many cranes obliges you to lock them away, point them only at buildings you have permission to hose, and tell the neighbours before the drill.

!
Common Mistake

Leaving agent services open on a public address for convenience. Anyone who finds them can attempt to use them, and the cost, or the damage, lands on you.

25Design Patterns for Distributed Testing

A few repeatable habits make distributed runs boring in the best way.

Pattern 1

Identical agents from one image

Build agents from a single prepared image so that versions, plugins, key store and settings are guaranteed to match.

Pattern 2

Parameterised plan

Read thread count, duration, target address and mode from properties, so one plan serves every environment and every size.

Pattern 3

Light controller, file results

Run the controller in command-line mode, use compact sending, write results to a file and analyse afterwards.

Pattern 4

Slice the data

Give each agent its own part of the accounts so no two machines collide.

Pattern 5

Smoke run before the real run

Start with a tiny crowd on all agents for a minute, check connections and results, then scale up.

Pattern 6

Agent health in the report

Include agent processor and memory graphs with the results, to prove the load generators were comfortable.

Pattern 7

Automation end to end

Create machines, produce the agent list, run the test, collect files and delete machines through one repeatable script.

Simple Analogy

A good restaurant chain gives every branch the same kitchen layout, the same recipe cards and the same opening checklist. Any cook can step into any branch and get the same result, which is what these patterns aim for.

“When every agent is a perfect copy, the only surprises left are the ones worth finding in the system under test.”

26Anti-Patterns to Avoid

These habits are tempting under time pressure and costly afterwards.

ANTI-PATTERN-01 Avoid
Problem

Large distributed runs are started from the graphical window, with several live tables and graphs attached.

Why It’s Harmful

The window and listeners consume the controller’s memory and processor, and slow the intake of results. The controller lags, agents back up, and the numbers shown are late and partial.

Correct Approach

Use the window for building and small checks only. Run large tests from the command line, write results to a file and build reports afterwards.

ANTI-PATTERN-02 Avoid
Problem

Agents are built by hand, one by one, with slightly different versions, plugins or settings.

Why It’s Harmful

Small differences cause failures on one agent only, and the cause is hard to find. Results from different agents may not be comparable.

Correct Approach

Create every agent from the same image or the same automated recipe, and verify versions at the start of each run.

ANTI-PATTERN-03 Avoid
Problem

Every agent holds the same data file and reads from the top.

Why It’s Harmful

Several machines use the same account at the same moment. The system rejects or locks them, and the test measures errors caused by the test design.

Correct Approach

Give each agent a separate slice of data, or generate unique values per machine.

ANTI-PATTERN-04 Avoid
Problem

The thread count is left as designed for one machine and the test is run on many.

Why It’s Harmful

The real load is the thread count times the number of agents, which may be many times the plan. The target is overwhelmed and conclusions are meaningless.

Correct Approach

Divide the target crowd by the agent count, and pass the share to agents as a property.

ANTI-PATTERN-05 Avoid
Problem

Results are accepted without checking whether the agents themselves were healthy.

Why It’s Harmful

A saturated agent produces slow numbers that are blamed on the target, leading to wasted tuning work and false conclusions.

Correct Approach

Record agent processor, memory and network during every run, and review them before reading the results.

ANTI-PATTERN-06 Avoid
Problem

The secure channel is switched off on a network that other people can reach, just to make the connection work.

Why It’s Harmful

Anyone on that network can send instructions to the agents, which can run scripts. The convenience becomes an open door.

Correct Approach

Keep the secure channel on, distribute one shared key store, and restrict network access to the controller.

27Advantages, Costs and Trade-Offs

Distribution solves a real problem and brings real complexity with it.

Advantages

  • Produces crowds far beyond what one machine can generate honestly
  • Keeps each generator comfortable so timings stay trustworthy
  • Allows traffic from several networks or regions
  • Gives one trigger and one combined result in the built-in setup
  • Scales out cheaply with disposable cloud machines

Disadvantages / Trade-offs

  • More machines to prepare, keep matching and secure
  • Network and firewall configuration can be fiddly
  • The controller can become a bottleneck
  • Data and clock management become your responsibility
  • Problems may appear on only one agent and be harder to trace
Simple Analogy

Using a fleet of delivery vans delivers more parcels than one van, but you must now manage drivers, routes and fuel. The fleet is worth it only when one van cannot do the work.

i
Remember

The cheapest distributed test is the one you did not need. Prove that a single tuned machine falls short before adding the machinery.

28Best-Practices Checklist

Run through these points before every distributed run.

1

Prove the plan on one machine

Correctness, correlation and data handling are debugged in a small local run before distribution.

2

Match versions and plugins

Same tool, same Java, same extensions, same key store on every machine.

3

Fix ports and addresses

Pin the ports, set announced addresses, and open the firewall in both directions.

4

Divide the crowd

Remember threads multiply by agents, and pass each agent’s share through properties.

5

Slice the data

Make sure no two agents use the same account at the same time.

6

Choose a compact result mode

Use batch or stripped sending and a file-only controller for large runs.

7

Synchronise clocks

Use a network time service on every machine.

8

Smoke run, then real run

A tiny test on all agents first, then scale in steps.

9

Monitor agents and target

Keep evidence that the generators were healthy.

10

Clean up

Collect logs, stop services, delete rented machines and reset test data.

29Real-World Scenarios

Five situations show how the ideas fit together in practice.

Retail sale-day rehearsal

An online shop expects a huge surge on a sale day. The team uses a dozen cloud agents to imitate tens of thousands of shoppers, with each agent holding its own slice of customer accounts. Results are written to a file and analysed after each rehearsal.

Ticketing platform opening

When tickets for a big event open, thousands arrive in the first seconds. The test team uses short ramp-ups, many agents and careful clock synchronisation to see how the queueing logic behaves at the opening moment.

Global service with regional users

A video-meeting service has users on several continents. Agents are placed in regions that match user populations, to see whether regional entry points and network paths perform acceptably.

Bank internal portal behind strict firewalls

Network rules make a live controller link difficult. The team starts the same plan independently on each agent through the company’s scheduling tool and merges result files afterwards.

Nightly regression with modest scale

A small team runs a nightly test on three fixed agents built from one image. A script starts the run, collects results and publishes a short report each morning, so trends appear early.

Simple Analogy

Each scenario is a different event for the same steward company: a stadium match, a festival, a cross-country relay, a locked-down embassy and a weekly town fair. The coordination technique is the same; the arrangements differ with the venue.

30Frequently Asked Questions

Short answers to the questions beginners ask most often.

Q1Does the controller also generate load?

In the usual remote start, no. Only the agents run the threads. The controller conducts and collects results, which keeps it free for that job.

Q2How many users will I get with five agents and a plan of two hundred threads?

One thousand, because each agent runs the whole plan. Divide your target by the number of agents when you design the plan.

Q3Does the controller send my data files to the agents?

No. It sends the plan only. Data files, plugins and certificates must already be on each agent, at the paths the plan uses.

Q4Can agents be different operating systems?

Generally yes, as long as the tool and Java versions match and file paths in the plan work on every machine. Keeping machines identical is still simpler and safer.

Q5Why does the test start but no results appear?

Most often the agents cannot connect back to the controller, because of a firewall, address translation or a wrongly announced address. Check the return direction.

Q6Do I have to keep the secure channel on?

You should, unless the network is fully isolated and trusted. If you keep it on, every machine must share the same key store file.

Q7Can I use the graphical window for the controller?

For learning and small checks, yes. For large measured runs, use the command line, because the window and live listeners can overload the controller.

Q8How do I give each agent a different thread count?

Make the plan read the thread count from a property and set that property in each agent’s own settings, instead of passing one global value to all.

Q9Do all agents start at exactly the same instant?

Nearly, but not exactly. The start order goes agent by agent over the network, so there may be small gaps. Ramp-up periods and steady-state measurement hide them for most tests.

Q10How do I know an agent was overloaded?

Watch its processor, memory, pause times and network during the run. Sustained high values, or timings that worsen without any change in the target’s health, point to an overloaded agent.

Q11Is the built-in distributed mode the only option?

No. You can run the plan independently on each machine and merge the result files afterwards. This avoids network setup and the controller bottleneck, at the cost of a combined live view.

Q12Can agents run in containers or the cloud?

Yes, and it is a popular choice. Take care with announced addresses, network rules, the agent list for each run and cleanup of machines afterwards.

Q13Why does a timer that waits for many users not work across machines?

Such elements coordinate only the threads on their own agent. They cannot see threads on other machines.

Q14What should I check first when an agent will not connect?

Confirm the agent service is running, the address in the list is right, the port is open from the controller, and the key store matches. Then read the agent’s own log.

31Summary and Key Takeaways

Distributed testing lets many ordinary machines act as one large crowd, with a controller that conducts and agents that perform. Success depends less on clever tricks than on discipline: identical machines, open and secure channels, divided crowds, separate data, light controllers and honest evidence that the generators were healthy. Follow these habits and the numbers you report describe the system you tested, not the machines you tested it with.

Key Takeaways

  • Controller conducts, agents perform — the controller sends the plan and collects results, while the test traffic flows from each agent straight to the target.
  • Threads multiply by agents — every agent runs the whole plan, so divide the target crowd by the number of agents and pass each share as a property.
  • Make the machines identical — same tool, Java, plugins, key store and files everywhere, ideally built from one image.
  • Open the doors in both directions — pin ports, announce reachable addresses and keep the secure channel on, with agents restricted to a private network.
  • Separate the data — files are not sent to agents, and identical copies cause collisions, so give each agent its own slice.
  • Protect the controller — use the command line, compact sending modes and file-only results for large runs.
  • Prove the generators were healthy — monitor agents and keep that evidence with the results, then clean up every machine afterwards.