JMeter Processors and Controllers

In this article, we have provided an overview of Pre-Processors and Controllers in JMeter (Part-III):

=> Follow comprehensive series of free JMeter tutorials here

This article will guide users through the usage of Pre-Processors, Post-Processors and controllers in JMeter. Controllers are very useful as they make your test scenarios.

You may want to test different scenarios in which you want to configure your own sequence of a request being sent to a server to monitor the response time and other performance factors. 

JMeter Processors and Controllers



These are the elements which are executed before a sampler is executed. You can attach the Pre-Processor with the sampler for which you want to make some changes to the request.

The simplest part of a case could be adding “Sample Timeout” preprocessor with an HTTP Request so that this request would run for only a defined amount of time. It also ensures that this modification is done only for the parent Sampler.

Below are some of the Pre-Processors used in JMeter:

  • Bean Shell Pre-Processor
  • HTML Link Parser
  • HTTP URL Re-Writing
  • JDBC Preprocessor
  • Sample Timeout
  • User Parameters

The most commonly used ones are explained below with examples. You may or may not need everything in your projects. Try to identify the scenarios related to your project and implement the ones that will help you cover real time performance scenarios.

User Parameters

User Parameters are used to define values for the variables before they are used in the Samplers. When JMeter executes this Pre-Processor element, it stores the values in the variables which can be referenced by any Samplers within the same thread group.

Adding User Parameters

If you have more threads than the number of users in “User Parameters” than extra threads will be re-iterated through the values again.

For example, if you have 5 users in your thread group but only 3 in the pre-processor, then your 4th and a 5th thread will use param1 and param2.

Users Parameter Table

Sample Time Out

This pre-processor is used to define the timeout duration for requests.

For example, if you have put a sample time out of 400 milliseconds, then all requests which are taking time>400 will have a failed response. Please see screenshots below.

Sample Time Out

Request Failed


Controllers are very important in building a real time JMeter test plan. It defines the sequence in which the requests are sent to the server.

For example, if you want to test a web application in which you want login to happen once and search, item selection requests to go one by one for all iterations. Controllers make it possible by managing the flow of requests going on the server under test.

Below are the most commonly used controllers in JMeter

  • Simple Controller
  • Module Controller
  • Once Only Controller
  • Interleave Controller
  • Loop Controller
  • If Controller
  • For each Controller
  • Recording Controller etc.,

Simple Controller

The simple controller does not perform any specific function. It is just a kind of container in which you can keep similar requests to make your test plan easily understandable.

Adding Simple Controller

Simple Controller

Loop Controller

If you want a specific request to run more iterations than what is specified in the Thread Group, you can put them under Loop Controller and enter the loop count in controller settings.

Example: If you have a thread group with 1 user and 3 iterations, then all your requests under this group will run 3 times. Now, if you have two HTTP Samplers under a loop controller with loop count 2, both these Samplers would run 1*3*2= 6 times.

Please see screenshots below which explain it further

Loop Controller

Results Loop Controller

Once Only Controller

This controller is used when you want to run a specific request only once even if you have multiple threads in the thread group. The simplest example which can be considered is “Fetching a website home page” or “Login into a web application”. Real Time scenarios would want it to happen only once and other requests such as searching or editing/deleting something that happens multiple times.

Requests that are to be executed only once can be placed under Once Only Controller.  Refer below screenshot for your reference. Once Only Controller settings bypass the parent thread group settings.

Once Only Controller

Recording Controller

Like the Simple Controller, the Recording Controller does not modify any sequence of requests that are being sent to the server. It is used with the HTTP(S) Script Recorder. All requests recorded with this Non-Test Element are saved under the recording controller.

You need to specify the target controller to save the recorded requests made to the server.

Recording Controller

Recording controllers and HTTP(s) script recorders come into pictures when testers don’t have the information on the requested URLs and parameters. They can simply record and capture all the requests hitting their servers. This works for both mobile as well as web projects.

Throughput Controller

This controller is also used to control the execution flow. As seen in the clipping below, this controller is further divided into two parts:

Throughput Controller

Percent Execution  This selection will allow Jmeter to execute only a certain percentage of the total iterations for Samplers placed under this controller. You can also check the “Per User” checkbox to control this at a user level.

For example, Thread Group is configured to have 10 users and the loop count is 5. Therefore, total iterations are 50. If % execution is set to 50%, then all the Samplers under the Throughput Controller will make 25 iterations only (50% of 50).

Total Executions – This lets users specify the number of iterations directly to the samplers contained under this controller.

Total Execution Controller

Interleave Controller

This controller lets you increase the scope of your performance testing by modifying sequences in a number of ways so that you get to test the load on the server when applications are hitting request with different sequences. The Interleave Controller makes alternative selections with the samplers under it.

If there are other controllers like Simple Controller kept under this block, the interleave controller gives the privilege to select one sampler each from a container for each iteration. To explain this further, consider the below test plan.

Interleave Controller Plan

Jmeter will iterate alternatively between the controllers for each iteration.  Therefore, the sequence will be mentioned below

Request1 -> Request3 -> Request 5 – Request2 -> Request4 -> Request6

Please see the below JMeter Results with Number of Threads = 2 and Loop Count = 2.

Interleave Controller Results

In the above example, Jmeter is interleaving with the next loop/iteration. There are settings in the Interleave Controller that will allow JMeter to send alternate requests with every new thread.

Interleave With Each Thread

Please see the results below. This is useful in scenarios where you want sequential or concurrent load hitting servers with a different sequence of the request from the same machine.

Interleave Thread Results

Random Controller

It works almost like an Interleave controller but does not pick the samplers in order. It just selects the sub controllers and the samplers inside them on a random basis.

IF Controller

If the Controller works in a similar way, an IF expression is treated in any programming language. The condition is validated first and then the components under this container execute if the condition is TRUE, otherwise, the elements outside the IF Controller will get executed.

Example: Continuing with one of the earlier examples involving Interleave Controller, now one of the two Interleave controllers has been kept under the IF Controller and Condition “$(COUNT) < 10 is added as a condition. Variable COUNT is defined in the config element “User Defined Variables” and is given a value equal to 11. Configuration is described below

Defining count variable

Defining and Assigning a value to COUNT Variable.

IF Condition Statement

Defining conditions in If Controller settings. Jmeter will validate this condition and if TRUE, will execute the blocks under this container.

As you can see from below test plan, only Request3, Request4 and Request5 will execute in case the IF Condition is evaluated as False.

IF Controller Test Plan

IF Controller Results

While Controllers

This controller executes the components under it till the condition becomes false.

For example, say we have a condition while($(count)<10), it will execute the child elements until the condition is false.  To test this, there should be a counter which gets increment or decrement on each iteration and then condition is evaluated. Config Element “Counter” can be used to serve this purpose.

Configure “Counter” config element to start at 1 and then increment at each iteration. See below for more clarification:

Counter Config Element

We will touch upon the rest of the controllers in our video tutorials.

Real Time Example

Please consider a scenario in which the testing team does not know the URLs and parameters of all the requests hitting the server under test. Now, to load test the server they need to record the requests and then modulate the load sequentially or concurrently and create scenarios out of them to do the performance testing.


  • Add a template to the Jmeter for Recording Controller
  • Set up a proxy on your browser and choose the same port for the HTTP(s) Script Recorder
  • Record the requests
  • Modify the Test Plan and increase the load
  • Group the transactions accordingly
  • Try different combinations of requests

JMeter’s Recording Template

JMeter also has some predefined templates. Select “Template” option from the File Menu. After selecting the template to choose “Recording” option in the window which opens and click on Create.

Jmeter Recording Template

Template Setting Recording

As soon as you select this Recording Template, you will see some components already added to the Test plan.

  • HTTP(s) Script Recorder under Work Bench
  • HTTP Request Default and HTTP Cookie Manager
  • Recording Controller under Thread Group.

You can either go to the proxy settings on your browser to talk to the JMeter proxy server or use the CHROME Extension Blazemeter to record the requests and then export them. jmx file for Jmeter.  There are many other extensions to record the script and then export it to JMeter. The BADBOY tool also works well with Jmeter to record both web and mobile hits.


Click on the. jmx option to export the recorded request to Jmeter. Now from Jmeter, open the. jmx file and see the requests and the parameters associated with each request.


By now, we hope you all must have got yourself very familiar with the basic logic of JMeter, how it simulates load, how to play with different types of Samplers, how to control execution flow with the use of Controller and using variables and functions to run the loops across the iterations. This is certainly not the end of the series of tutorials on JMeter.

There are many video tutorials to follow which will guide testers with more hands on different scenarios in Jmeter and how each JMeter component can be utilized in the best manner.

=> Check the complete list of JMeter video tutorials here

Please share your feedback or questions with us in the comment section below. We would love to hear from you.

Recommended Reading

1 thought on “JMeter Processors and Controllers”

  1. In Pre-processor, twice paragraphs are available in same matter. Please find and resolve this?


Leave a Comment