Site icon Vinsguru

JMeter – How To Distribute User Load In The Test Plan

In this article, Lets see how we can distribute the load across the critical scenarios of the application using Throughput Controller in JMeter.

Overview:

Identifying the Critical business transactions is an important phase in order to create a proper workload model for our Performance Test. We had already published an article on Performance Workload Modeling using Little’s law. If you have not read that, I would suggest you to read that article first.

Tools like Google Analytics can help us in finding the frequently visited pages of our application & the percentage of user load among these pages. This information provided by the tool needs to be thoroughly reviewed by Performance tester with the help of Business side Product owners / Project managers / BA / Application Architect etc to confirm the scenarios to be tested and user load distribution.

Once the script is created & verified, user load has to be distributed in the test plan in such a way that it mimics the Production behavior.

User Load Distribution:

Lets consider a simple application with below functionalities.

  1. Flight Search
  2. New User Registration & Book flight
  3. Existing User Login & Book flight
  4. Admin User Login & Edit Ticket
  5. Admin User Login & Cancel Ticket

If our requirement is to test the above application with 100 concurrent users, we can not distribute the load like 20 users per functionality. We will know that users who are all searching for a flight will not book the ticket. So, We will have more users on a flight search page than the ‘booking a flight’ page.

Lets assume that among 100 concurrent users,

 

Note: % in the below diagram shows the % of total users who accessed the application.

 

Throughput Controller:

Lets assume we already have created & verified the scripts for these business functionalities like Search / Login / Book etc. However we need to use appropriate controller to distribute the load to simulate production like behavior. That is where Throughput Controller comes into picture.

The name of the controller seems to mislead – It does not actually control the throughput of the application server. If that is what you are looking for, You need to take a look at Constant Throughput Timer.

Throughput controller has below options to control the execution of the samplers

To understand this behavior better, I create a quick test plan in JMeter as shown below.

Total Executions:

I create a Test Plan like this with 1000 concurrent users.

Even if we had 1000 users, only 100 samplers were executed – remaining 900 threads have not sent any request as the Throughput Controller total execution limit has been reached already.

Percent Executions:

I modify the Test Plan like this with 1000 concurrent users.

Because of the ‘Percent’ execution, out of 1000 concurrent users, 600 threads executed Sampler A and while others were sending request B.

For our requirement of above flight search application, I would be using Percent Execution option and per user checkbox would be unchecked – Because the percent is among all VUsers, Not per user.

We can place Throughput controller inside another Throughput Controller. If I modify the test plan as shown below, that is, 60% of total threads will execute A. Only 40% of 60% will execute B. So we get result as shown below.

Workload Modeling:

 

If we take a look at the above user load distribution diagram, our requirements are,

 

Test Results:

I run the test for 100 concurrent users – Page visits have been distributed as per our requirement.

When i run the same test for 10000 concurrent users,  Page visits are still as per our requirements due to ‘Percent Execution’ option of Throughput Controller.

Summary:

We are able to model our workload as per the Production behavior using Throughput Controller instead of creating multiple Thread Groups. In the above test plan, I might have redundant ‘Book’ sampler. But in the actual test plan, we need to keep group the samplers based on the user action on the application using Transaction Controller. These Transaction Controllers will be kept in the reusable Test Fragments. We would call these fragments using Module Controller to avoid any redundancy.

Check below articles for more information.

 

Happy Testing & Subscribe 🙂

 

Share This:

Exit mobile version