0
votes

In my test plan, I have 24 throughput controllers having different percent executions with the least being 1%. 10 different throughput controllers have 1 percent execution. Each throughput controller has many transaction controllers under it. When I run a test for 1 hour, the samplers defined under some of the least percentage throughput controller(s) do not execute even once. I've made sure the total number adds to 100% across all the 24 throughput controllers. How can I ensure that all the samplers defined across all the throughput controllers execute at least once?

For the least percent throughput controllers, I changed them to "Total Executions" as 1. However, the samplers defined under these total executions are always executed first after the test begins which is not what I needed.

2

2 Answers

3
votes

The whole logic of deciding when to run samples below controller looks like this (from ThroughputController.java:

/**
 * Decide whether to return any samplers on this iteration.
 */
private boolean decide(int executions, int iterations) {
    if (getStyle() == BYNUMBER) {
        return executions < getMaxThroughputAsInt();
    }
    return (100.0 * executions + 50.0) / (iterations + 1) < getPercentThroughputAsFloat();
}

where executions is passed in as number of times samplers under controller did run, and iterations as number of test iterations in total. As you see, there's no dependency on other controllers, and it will not check for total percentage across various controllers.

So that explains

  1. Why if you specify "Total Executions" as 1, it will execute on first iteration and never again: on first iteration executions=0 < getMaxThroughputAsInt(), which you set to 1, so samplers under controller will run. On all following iterations, executions=1, so nothing will run.

  2. What to expect when you configure controller with certain percentage. For instance controller configured to run with 1% needs at least 51 iterations to run once: (100 * 0 + 50) / (50 + 1) < 1. If your test is running less iterations, Throughput controller with 1% will never run.

  3. How to make sure that each controller runs at least once (which derives from the previous point): make sure number of iterations is sufficient.

Also make sure Per User setting in controller is correct, and is per your expectations:

If unchecked, then the calculation will be global for all users <...> number given for throughput will be the total number of executions made. If "per user" is checked, then the total number of executions would be the number of users times the number given for throughput.

0
votes

Throughput Controller does not guarantee that its children will be executed, if you need to ensure that each sampler will be executed at least once you need to consider moving to Switch Controller instead and define your throughput logic via Switch statement

See Running JMeter Samplers with Defined Percentage Probability for more details.