Thread Group in JMeter

A Thread Group is a set of threads executing the same Scenario. It is the base element for every JMeter test plan.

There are multiple thread groups available that can be configured to simulate how the users interact with the application, how the load is maintained, and over what period of time.

Set the number of iterations in the configuration. Thread behavior is defined according to ramp up and destroyed once the number of repetitions per Thread has elapsed. This is how a Thread Group Element looks as below :

Recordring Test Scripts in JMeter

Thread Group Elements in JMeter

The different components of JMeter are called Elements. Each Element is designed for a specific purpose. The figure below gives some common elements in JMeter.

We will discuss the most important components of the Jmeter and remaining we will discuss when they are used.

  • Thread Group
  • Samplers
  • Listeners
  • Configuration

Thread Group:

Thread Groups is a collection of Threads. Each Thread represents one user using the application under test. Each Thread simulates one real user request to the server. The controls for a thread group allow you to Set the number of threads for each group.

For example, if you set the number of threads as 100, JMeter will create and simulate 100 user requests to the server under test.


As we know already that JMeter supports testing HTTP, FTP, JDBC, and many other protocols. We already know that Thread Groups simulate user requests to the server. But how does a Thread Group know which type of applications (HTTP, FTP, etc.) it needs to make?

The answer is Samplers :

  • The user request could be FTP Request, HTTP Request, JDBC Request...Etc.
FTP Request:

Let's imagine you want to performance test an FTP server. You can use an FTP request Sampler in JMeter to do this task. This controller lets you send an FTP download a file or upload a file request to an FTP server.

  • For example, if you want to download a file Test.txt from an FTP server under test, you need to configure some parameters in JMeter. JMeter will send FTP command to FTP server, and then download a file Test.txt from that server.
HTTP Request :

This Sampler lets you send an HTTP/HTTPS request to a web server. Consider the example below. JMeter sends an HTTP request to the Google website and retrieves HTML files, images from the website.

JDBC request:

This Sampler lets you execute Database Performance Testing. It sends a JDBC Request (an SQL query) to a database.

For example, a database server has a field test_result stored in a table name test_tbl. You want to query this data from the database server; you can configure JMeter to send a SQL query to this server to retrieve data.

BSF Sampler:

This Sampler allows you to write a sampler using a BSF scripting language. Here is an example of BSF Sampler in JMeter

Access Log Sampler:

This Sampler allows you to read access logs and generate HTTP requests. The log could be image, Html, CSS...

SMTP Sampler:

If you want to test a mail server, you can use the SMTP sampler. This Sampler is used to send email messages using the SMTP protocol.

Assertions in JMeter

How to Create a Thread Group in JMeter

Thread Group is an element of a Test Plan. To create a Thread Group, it is required to have the Test Plan created.

Below are the steps to create Thread Group :
  • Start JMeter
  • Select Test Plan on the tree
  • Add Thread Group: Open the thread group panel by Right Click on Test Plan and then going to Add >> Threads >> Thread Group.
Put a load on the Thread Group and playback.
  • The First step is to Launch the JMeter in your system.
  • Next, Right-click on the Test Plan-->Add--> Non-Test Element--> HTTP(s) Test Script Recorder.
  • Go to the Test Plan Creation tab and then set the Target controller as shown below.
  • Next, click on the Requests filtering and then click on the Add Suggested Excludes.
  • And Make sure that the Proxy has been set to the 8888.
  • Click on the Start Button and then go to the Firefox browser and start actions.
  • Open the, the below welcome will appear.
  • Next, Choose the Departure City and Destination city and then Click on the Find Flights button.
  • Next, find the flight according to the timings and fair and then click on the Choose this flight.
  • The next reservation page will appear, fill the required details, and then click on the Purchase Flight.
  • After purchase, you will receive a confirmation message with all the details below.
  • Now, Click on the stop button to stop recording.
  • Next, go back to the JMeter and expand HTTP(s) Test Script Recorder, you will find the recorded steps.
  • Sometimes unnecessary steps will be recorded, check and delete the unwanted steps.
  • Next, we have to add these Scenarios into the thread Group.
  • Right-click on the Test Plan-->Add-->Thread User(s)-->Thread Group.
  • The Thread Group window will look like, as shown below.
  • So, we are going to put the load on the thread Group.
  • Now, Enter the number of users as 50, so the 50 users will be present in the thread group.
  • Enter the Ramp-up period as 5 that means how many seconds you want users to be on that server. That means at 1st second, 10users will hit the server, and at the 5th second, all the users will be on the server.
  • Next is loop count, all the 50 users will repeat this Scenario for five times that means 50*5=250, a total of 250 Requests.
  • Next, we have an Infinite option; if you want Infinite loop, then check in the Infinite possibility.
  • Next, you will see a section called Action to be taken after a sampler error. There we have Continue, Start Next Thread Loop, Stop Thread, Stop Test, Stop Test Now.
  • Continue : If a User/Thread fails, continue with the remaining users.
  • Start Next Thread Loop : If a User/Thread fails, start the next thread group by halting the current thread group
  • Stop Thread : If a User/Thread fails, stop that particular thread group not to execute further
  • Stop Test : If a User/Thread fails, the entire test is stopped at the end of any current samples.
  • Stop Test Now: The entire test is stopped abruptly. Any current samplers are interrupted if possible.
  • Here, we are selecting continue because out of 50 users, if five also failed, we want to know how 45 users are performing.
  • Now we have set all the parameters, but all the scenarios are not under the Thread Group; they are under HTTP Test Script Request.
  • So copy all the scenarios and paste it inside the Thread Group.
  • Next, save the thread group and add the Listeners to monitor the process of your thread group.
  • Right-click on the Thread group and then Add-->Listerners
  • As we can see, a lot of listeners in the List drop-down, but most commonly, we use three of them.
  • The Listeners depend on the Project and the Parameter that how you wanted to see the result of the thread group.
  • Add view Results Tree Listeners under the Thread Group, and then add Aggregate Report.
  • And Also, add Graph Results Listener to the thread group.
  • Now save and run the Thread group, you can see a different type of results in the View Result Tree, Aggregate Report, and in the Graph Results.
  • If you click on the View Result Tree, you will see the below output. You can see that all scenarios are started with Green mark in the below image that means all your request has been passed successfully. IF got any Red mark, then the scenarios got failed.
  • And when you click on any one of the Scenario, you will see the request and responses, as shown below.
  • The Request section looks as below.
  • If you click on the View Aggregate Report, you will see the below output.
  • If you click on the Graph Results, you will see the below output.
  • Compare to the aggregate report, and the View Result Tree is more important because sometimes the Aggregate report will give parameters even if your request is failed. Still, the View Result Tree will give the response only to the Successful requests.
  • How would you know that your response is correct in the View Result Tree? Just click on any scenario and then go to the response Data section and then search in the header about your key elements; it will highlight them.

Different Types of Thread Group

Additional Plugins for Jmeter

In this section, we will discuss some additional plugins which will simulate real-time load on our application. We know how to put a load on the application, and we can do that with the help of Thread Group.

We can do some advanced real-time load configuration with the help of some advanced plugins which are externally available.

  • First, download the JMeter jar file into the system.
  • Go to the chrome browser and search for the JMeter plugin, and you will see the below page.
  • Click on the official link and you will find a lot of different JMeter Plugins.
  • Instead of downloading one by one plugin, let us download the plugin Manager itself.
  • The Plugin manager will help us to download any plugin from the tool.
  • Click on the Plugin Manager, as shown below.
  • Next, click on the Plugins Manager Jar File, as shown below.
  • Once the file got downloaded, Save the Jar file inside the JMeter's lib/ext directory.
  • Restart the JMeter, and then launch the JMeter in the system. Once you click on Options, you will find the Plugin Manager, as shown below.
  • Click on the Plugin Manager; you will find the three sections below.
  • Go to the Available Plugins and search for the required plugin, and then click on the Apply changes and Restart the JMeter.
  • So that the JMeter will restart, Now selected plugins will be in your machine.
  • Custom Thread Group is a plugin that we need to simulate the real-time load in our application.
  • Let us see how we can utilize that to create one plugin like this.
  • Now click on the Test Plan and then and select add Thread Group, under the thread group you will find a lot of options after installing the Plugin Manager.

Concurrency Thread Group in JMeter

The Concurrency Thread Group, which is an alternative to the Stepping Thread group. The Concurrency Thread Group provides a better simulation of user behavior because it lets you control the length of your test more easily.

The Following Example demonstrates the currency thread group in JMeter

  • Open the JMeter, and add HTTP(s) Test Script Recorder to the Test Plan.
  • Next click on the Target controller under the Test plan creation and select the Test Plan-->HTTP(s) Test Script Recorder.
  • Go to the Firefox browser and then set the port address for recording purposes.
  • Go to the JMtere and then click on the Start Recording.
  • Next, go to the firefox browser and then click on the given link and then select the destination and departure location and then click on Find Flight
  • Select the flight according to the fair and timings and then click on the Choose this flight.
  • Next, fille the required details and then click on the purchase flight.
  • Next click on the Stop recording button.
  • Now, go back to the JMeter and then click on the HTTP(s) Test Script Recorder, you will find that the actions have been recorded.
  • Now add One Thread Group to the Test Plan and then Move all the test scripts to that Thread Group.
  • Next, add View Result Tree Listener to the Thread Group.
  • Next, add Concurrency Thread Group to the Test Plan.
  • Enter the parameters in the Concurrency thread group as below.
  • Now, add All the test script recordings into the concurrency thread group and then save and run the test plan.
  • As per the given parameters, the 50 users will be on the server in the three steps every 3 seconds.
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions