People often get confused in the usage of JMeter Loop Count and JMeter Thread Count and more importantly, how will it impact their load test. Do you know the answers? Here are two scenarios:
- Scenario 1: If the number of thread count is 10, ramp-up time is 10 and loop count is 1.
- Scenario 2: If the number of thread count is 1, ramp-up time is 1 and loop count is 10.
What is the difference between the two scenarios and will it have similar performance impact? What will be the delay between requests in scenario 2? Will all the threads remain alive in Scenario 2?
Most people are aware of the fact that a thread simulates a user and loop-count means the number of times the thread will make request.
Let’s walk through the differences. In Scenario 1, 10 threads are used, and the ramp-up period is 10 seconds, so JMeter will take 10 seconds to get all 10 threads up and running. Each thread will start 1 second (10 divided by 10) after the previous thread was begun.
Here’s another example from the JMeter Thread Group user manual:
If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.
In Scenario 2 JMeter will run 1 thread, and after the completion of one thread, the next one will start, and so on 10 times.
A big difference! And it will have a different impact on performance.
Check this JMeter thread groups guide for get more information on JMeter Loop Count and JMeter Thread Count.
Let’s be clear on some of the details. In both the scenarios 10 threads will be created. In scenario 2 when a new thread starts the older thread remain alive. The difference is that in scenario 1, threads may work in parallel, and in scenario 2 each thread starts after the previous one stops. And there is no delay between threads unless you specify them.
So eventually only one 1 thread remains alive in Scenario 2 and all the threads remain alive in Scenario 1.