Skip to content

What Are Iterations in Load Testing?

Iterations in the context of load testing refer to the number of times a specific set of actions or a test script is executed by a virtual user during the load test. In essence, an iteration represents a single cycle of a test scenario.

To switch from "Duration" to "Iterations" when creating a new load test, open Fine-tune under How much load? and tick Run by iterations instead of time; untick it to go back to a set duration. The iterations slider goes up to your plan's limit (60 on the Free plan). In cloud and JMeter tests the number you set applies to each virtual user. In k6 tests it is the total for the whole test: all virtual users start at once, with no ramp-up, and share those iterations between them.

Here's a breakdown inspired by JMeter and general load testing principles:

  • Repetitive User Behavior Simulation: Iterations allow testers to simulate repetitive user behavior. For instance, a user might visit an e-commerce site, browse products, add an item to their cart, and then checkout. This sequence of actions might be repeated several times by the same user or different users over a given period.
  • Identifying Potential Issues: Iterations help in identifying memory leaks or other issues that might arise when the same set of actions are performed repeatedly.
  • Loop Count: In JMeter, iterations are managed through "Loop Count" in the Thread Group. If you set the loop count to 5, each virtual user will execute the test plan (or the sequence of samplers) 5 times.
  • Infinite Loops: plain JMeter also has an "infinite" loop option for a Thread Group. The LoadFocus form does not: set a fixed number of iterations, or switch to Duration to run for a set time.

3. Difference Between Iterations and Number of Users

Section titled “3. Difference Between Iterations and Number of Users”
  • Understanding the Difference: It's important not to confuse iterations with the number of users. If you have 10 virtual users and 5 iterations, it means each of those 10 users will execute the test script 5 times. So, you'll have a total of 50 executions of your test plan. That is how LoadFocus cloud and JMeter tests count. k6 tests count differently: 10 virtual users and 50 iterations means 50 executions in total, shared by the 10 users, and the line under the chart says so ("10 users share 50 iterations in total, starting at once.").

4. Why Are Iterations Important in Load Testing?

Section titled “4. Why Are Iterations Important in Load Testing?”
  • Consistency and Performance: By repeating the test multiple times (iterations), testers can ensure the consistency of the application's behavior and performance. If an application performs well in the first iteration but degrades in performance in subsequent iterations, it might indicate issues like resource saturation, inadequate garbage collection, etc.
  • Comprehensive Testing: It provides a more comprehensive picture of how an application behaves under repeated, sustained load, rather than a one-off spike.
  • Independent Iterations: When setting up iterations, ensure that each iteration is independent. For instance, if a user adds an item to a cart in one iteration, ensure the cart is cleared before the next iteration begins.
  • Resource Monitoring: Monitor system resources during prolonged tests with many iterations to identify potential bottlenecks or degradations over time.

In summary, iterations are a fundamental concept in load testing, offering testers a mechanism to replicate real-world user behaviors and assess how systems perform under repeated actions. Properly managing and understanding iterations can lead to more robust and accurate load testing outcomes.