Controllers in JMeter: Loop, Logic, Transaction

โšก Smart Summary

Logic controllers in JMeter determine the order in which user requests run within a thread, with controllers such as Loop, Random, Simple, Module, and Recording shaping how a performance test plan sends requests to the server.

  • ๐ŸŽ›๏ธ Logic Controllers: Controllers set the order in which requests run in a thread.
  • ๐Ÿ” Loop Controller: Runs a sampler a set number of times within the thread loop.
  • ๐ŸŽฒ Random Controller: Runs the child requests in random order each loop.
  • ๐Ÿงฉ Module Controller: Adds modularity by selecting which module runs.
  • โบ๏ธ Recording Controller: Stores recorded test steps as a placeholder.
  • ๐Ÿค– AI Assistance: AI helps design and analyze JMeter performance test plans.

Controllers in JMeter

What is the Logic Controller?

Logic Controllers let you define the order of processing request in a Thread. It lets you control “when” to send a user request to a web server. For example, you can use Random Controllers to send HTTP requests to the server randomly

Logic Controllers determine the order in which user request is executed.

Some commonly used Logic controllers are below:

The Logic Controller

Recording Controller

JMeter can record your Testing steps; a recording controller is a placeholder to store these recording steps.

Recording Controller

Simple Controller

Simple Controller is just a container for user request.

Simple Controller

Loop Controller

Loop Controller makes the user request run a specified number of times or run forever as shown in figure:

Loop Controller

Random Controller

Random Controller makes all the user requests run in the random order in each loop period.

For example, you have 3 user requests to website http://www.google.com in following order:

  1. HTTP request
  2. FTP request
  3. JDBC request

These 3 requests should run 5 times. Total 15 user requests will be sent to Google server by JMeter.

In sequential order, requests are sent sequentially in following order:

HTTP request ->FTP request->JDBC request

for each loop.

Random Controller

In random order, requests are sent as randomly,

FTP request ->HTTP request->JDBC request

Or

JDBC request ->FTP request->HTTP request

For each loop.

Module Controller

The goal of Module Controller is to add modularity to JMeter.

The general idea is that web applications consist of small units of functionality (i.e. Logon, Create Account, Logoff…). This functionality can be stored in Simple Controller as “modules”. Module Controller will choose which module needs to run.

Module Controller

Consider the following scenario –

You want to simulate:

  • 50 users logging out,
  • 100 users logging in
  • 30 users search www.google.com

You can use JMeter to create 3 modules. Each module simulates each user activity: Login, Logout, and Search.

Module Controller

The Module controller chooses which module needs to run.

Module Controller

Other Important Controllers

  • Interleave Controller: picks up and makes one of user request run in each loop of the thread.
  • Runtime Controller: controls how long its children are allowed to run.

For example, if you specified Runtime Controller 10 seconds, JMeter will run your test for 10 seconds.

Other Important Controllers

  • Transaction Controller: measures the overall time taken to finish a test execution
  • Include Controller: is designed to use an external test plan. This controller allows you to use multiple test plans in JMeter. See detail in JMeter Performance Testing.

Loop Controller Example

This section shows you step-by-step instruction to add Loop Controller set to your current performance test plan.

The Loop Controller makes the samplers run as a certain number of times, in addition to the loop value you specified for the Thread Group. For example, if you

  • Add one HTTP Request to a Loop Controller with a loop count 50
  • Configure the Thread Group loop count to 2
  • Then, JMeter will send a total of 50 * 2 = 100 HTTP Requests.

This is the roadmap of this example:

Loop Controller Example

Step 1) Configuring Thread Group

We re-use the Step 1, 2 in tutorial JMeter Performance Testing.

  1. Add Thread Group

Right click on the Test Plan and add a new thread group: Add-> Threads (Users) ->Thread Group

But in Thread Group control panel, enter Thread Properties as follows:

Add Thread Group

It will make one user request to the web server google.com and run it 2 times.

  1. Add JMeter elements

Add HTTP request default to www.google.com.

  1. Adding Loop Controller

Right Click Thread Group -> Logic Controller -> Loop Controller

Adding Loop Controller

Step 2) Configuring Loop Controller

Add value 50 to Loop Count field as below figure. It will make one user request to the web server google.com run it 50 times, in addition to the loop value =2, you specified for the Thread Group above.So JMeter will send a total of 2 * 50 = 100 HTTP Requests.

Configuring Loop Controller

Right click Loop Controller, Add -> Sampler -> HTTP request

Configuring Loop Controller

Step 3) Add View Results in Table

We re-use Step 2 in Timer to add View Results in Table

So the test plan is shown in below figure

Add View Results in Table

Step 4) Run your test

Now return View Results in Table, click Start button on the Menu bar (Ctrl+R) to run a test

As shown in the figure below, JMeter simulates one user request, which is sent 100 times, to the web server http://www.google.com/. The Test is stopped after a user request was sent in 100 times.

Run the Test

Troubleshooting

  1. If you face the issue while running the above scenario … do the following
  2. Check whether you are connecting to the internet via a proxy. If yes, remove the proxy.
  3. Open a new instance of Jmeter
  4. Open the ControllerTestPlan.jmx in Jmeter
  5. Click on Thread Group -> View Result in Table
  6. Run the Test

FAQs

A sampler sends an actual request to the server, such as an HTTP or JDBC request. A logic controller does not send requests itself; it controls the order and conditions under which its child samplers run within a thread.

The Transaction Controller measures the total time taken to complete a group of samplers as a single transaction. It is useful for timing a multi-step business process, such as login then search, rather than each request separately.

They multiply. If a Loop Controller is set to 50 and the Thread Group loop count is 2, each sampler inside the controller runs 50 times per iteration, for a total of 50 times 2, which is 100 requests.

Yes. AI can suggest realistic workload models, generate test data, and analyze result graphs to flag bottlenecks. Machine learning detects performance anomalies and predicts capacity, helping engineers design and interpret JMeter tests faster.

AI models expected load patterns, auto-tunes test parameters, and analyzes metrics to detect regressions and root causes. These intelligent features make performance testing more predictive, turning raw JMeter results into actionable capacity insights.

Summarize this post with: