Javatpoint Logo
Javatpoint Logo

JMeter Distributed Load Test (Throughput Controller)

In this section, we shall learn how to create a distributed load test plan in JMeter using Throughput Controller.

For our test purpose, we shall create distributed load on some of the web pages under the URL of our website www.javatpoint.com. These web pages include:

Home Page: www.javatpoint.com

Web page 1 (Java): www.javatpoint.com/java-tutorial

Web page 2 (C_Programming): www.javatpoint.com/c-programming-language-tutorial

Web page 3 (Cpp): www.javatpoint.com/cpp-tutorial

The following image shows the home page of our website:


JMeter Distributed Load Test

Note: Suppose, we have created 10 virtual users (Threads) to perform the distributed load test on our website then all the other web pages will be tested by a constant load of 10 virtual users. However, this is not a real world scenario. In real world, there might be variance in load of different webpages under the same URL.

Let us first create a distributed load test plan without using Throughput Controller. For this test, we have distributed single virtual user to each Thread Group.

Create JMeter Test Plan

  • Go to your JMeterbin folder and double click on the ApacheJMeter.jar file to launch JMeter interface.
  • Click on the Test Plan node.
  • Rename this test plan node as Distributed Test.
  • Select the Distributed Test node and right click on the selected item.
  • Mouse hover on "Add" option, then elements list will be displayed.
  • Select Threads (Users) > Thread Group.

JMeter Distributed Load Test

Add Sampler

We have to add a HTTP RequestSampler in our Thread Group.

  • Select the Thread Group and right click on the selected item.
  • Mouse hover on "Add" option, then elements list will be displayed.
  • Select Sampler > HTTP request option.
  • It will add an empty HTTP Request Sampler.

JMeter Distributed Load Test

Configure the fields of HTTP Request Sampler as:

  • Name - Home Page.
  • Server Name or IP - In our case, web server name will be www.javatpoint.com.

Now, we will copy the thread group and paste it inside our test plan three times. Rename each of the HTTP Request Samplers as per the web pages under test. Server Name for each HTTP Request Sampler will be same.

The following image shows the directory structure under the Distributed Test Plan.


JMeter Distributed Load Test

Configure the path name for Java, C_Programming and Cpp samplers respectively.

The following images show the respective path name for each of the above mentioned samplers.


JMeter Distributed Load Test
JMeter Distributed Load Test
JMeter Distributed Load Test

Add Listener

  • Select the Distributed Test Plan element.
  • Mouse hover on "Add" option then elements list will be displayed.
  • Select Listener > Aggregate Report.

JMeter Distributed Load Test

Save and Execute Test Plan

  • Click on File > Save Test Plan as.
  • Save the entire test plan as Distributed_test1.jmx.

JMeter Distributed Load Test
  • Click on Run > Start to execute the test plan.

Verify the Output

You can see the distribution of load for each web page in the #Samples tab.


JMeter Distributed Load Test

Now, we have successfully executed our Distributed Load test plan without using Throughput Controller. However, we cannot decide the number of actual users during a real world load test on an application. In that case, we have to use a Throughput Controller.

Adding Throughput Controller

First we have to create a Master Thread Group to our test plan.

  • Select the Distributed Test node and right click on the selected item.
  • Mouse hover on "Add" option, then elements list will be displayed.
  • Select Threads (Users) > Thread Group.
  • Rename this thread group as Master Thread Group.
  • Select the Master Thread Group node and right click on the selected item.
  • Mouse hover on "Add" option, then elements list will be displayed.
  • Select Logic Controller > Throughput Controller.

JMeter Distributed Load Test

The following image shows the default control panel of a Throughput Controller.


JMeter Distributed Load Test

Follow these steps to create a test plan under the Master Thread Group node:

  • Copy the "Home Page" sampler and paste it inside the Throughput Controller.
  • Create three more Throughput Controller and copy-paste the rest of web page samplers.
  • Disable/Deleteall the thread groups under the Distributed test plan node.

The following image shows the directory structure under the Master Thread Group node.


JMeter Distributed Load Test

Now, we have configured the total number of users in the Master Thread Group as "10". As a consequent of it the "%" execution for each of the throughput controller will be distributed as per the total number of users in the master thread group.

We have distributed the "%" execution for each Throughput Controller as:

  1. 10 % for Home Page
  2. 20 % for Java
  3. 20 % for C_Programming
  4. 50 % for Cpp

Note: The number of threads(Users) in the Master Thread Group can vary as per the real world expected load on the application.

The following image shows the configuration of Master Thread Group and the entire Throughput Controllers undertest.


JMeter Distributed Load Test
JMeter Distributed Load Test
JMeter Distributed Load Test
JMeter Distributed Load Test
JMeter Distributed Load Test
  • Click on Run > Start, to execute the test plan.

Verify the Output


JMeter Distributed Load Test

You can see the distribution of load for each web page in the #Samples tab.


JMeter Distributed Load Test




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA