How to control the scale of the business in the JMeter test plan _jmeter

Source: Internet
Author: User
In the performance test mix scenario, we need to combine multiple business operations into the scenario.
For example, there is a forum for business distribution as follows:
The percentage of new posts and replies is 2:3,
So how do we control the proportions in the JMeter test plan?

Here's a couple of ways to do this:
1. Multi-threaded Group mode

2. Logic Controller Control

Multithreaded Group mode:

We know that JMeter uses thread groups to simulate virtual users, and JMeter can also support multiple thread groups in a schedule.
With this feature we can put the new post business in one thread group, the reply business in another thread group.
In order to create a proportional relationship between the volume of business, we control the number of threads to achieve the effect. The following figure:



Replaytopic for the reply thread group, add 90 threads;
Sendtopic to open a new thread group, add 60 threads, just 3:2

Of course, this can only be approximate, if the response time of these two transactions is not the same, the final number of business to complete the proportion will be different.
The current number of threads is assumed to be the same as the response time of two business, so this is a perfect situation.
As can be seen, this way of controlling is not perfect.

Here we use the 2nd way:

Controller control

The following figure is an if controller, which can be used as a condition by using an expression, so that we're going to get the number of iterations to decide
is the reply or the post, such as a total of 3 iterations, the 1th and 3rd iterations to open a new post, 1,2,3 iterations will be replies



Next we're going to get the number of iterations, and the JMeter function helper provides a __counter function that can be used to get the current
Number of iterations.

Well, we have the idea, the number of iterations can also be obtained, that how to maintain the proportion of 3:2. This is a mathematical problem.
Do not sell the view child, directly on the code:
${__counter (True,)}%2==1| | ${__counter (True,)}%3==0
The above __counter (true) is the number of times the current iteration is fetched, and the% is the remainder, that is, the new post is executed in addition to 2 1 and 3 divisible.
9 Iterations For example, replies 9 times, 1,3,5,6,7,9 iterations will open a new post, back just 6 times
9:6=3:2
Basically protects the ratio by 3:2.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.