Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter Loop Count

Tags:

jmeter

I want to run a JMeter test with a number of concurrent threads with each thread sending a request every 10 seconds.

These are my thread properties.

Number of Threads: 10

Ramp-Up Period: 10

Loop Count: 1

Result: 10 requests divided over 10 seconds, so every second a request and exactly what I want.

Now I want to run this test for 3 times(30 seconds). So I set the Loop Count to 3.

But the result is: 30 requests in 10 seconds. This is strange, because I would expect to run this for 30 seconds and get 1 request per second.

How can I achieve this with JMeter?

My final goal is to run this test for a long period and also increase the Number of Threads.

How to do this with JMeter?

like image 331
user1187636 Avatar asked Feb 03 '12 14:02

user1187636


3 Answers

I researched this today and came to this conclusion: The Loop Count setting is a complete misnomer. It doesn't actually loop in any sort of chronological sense, even if your Test Plan has Run Thread Groups consecutively checked. What it does do is multiply your thread group and run all multiples concurrently. Therefore, the Ramp-Up Period is only respected once, and NOT once per "loop" - there is no temporal loop!

An explanation with graphs can be found here: http://pro-programmers.blogspot.com/2009/07/jmeter-max-threads-with-rump-up-and.html

like image 136
Toddius Zho Avatar answered Nov 11 '22 19:11

Toddius Zho


Seems that the most simplest ways to control throughput in your tests is using either standard "out-of-box" Constant Throughput Timer or custom Throughput Shaping Timer from jmeter-plugins collection.


In both the cases structure of the test will be like the following:

Thread Group
Number of Threads = N
Ramp-up Period = N
Loop Count = 1
    Constant Throughput Timer
    Target Throughput = 60
    Calculate Throughput based on = "all active threads in current thread group"
    . . .
    Loop Controller
    Loop Count = M
        . . .
        HTTP Request
        . . .

Here Loop Controller defines number of iterations.


Looks like both the timers are not absolutely precise as well as both are a bit differently configurable:

CTT

TST


Here is also a kind of practical example how to vary the throughput.

like image 22
Aliaksandr Belik Avatar answered Nov 11 '22 20:11

Aliaksandr Belik


In my experience with Jmeter if you set

Number of Threads: 10

Ramp-Up Period: 10

Loop Count: 1

you create 10 threads into 10 seconds so you create 1 thread every second. With loop count of 1 you repeat this once. But if you increase loop count I think that you don't create new threads but repeat jmeter elements procedure in the Thread Group therefore the time beetween the request isn't 30 seconds but just over 10s. If you want to create 30 threads within 30 seconds you have to set

Number of Threads: 30

Ramp-Up Period: 30

Loop Count: 1

If you want to repeat 10 threads for 3 times with ramp- up of 10 seconds you should insert a Timert->Constant Timer with thread delay of 10000 ms so you obtain 30 requests in 30 seconds (really you should consider the time of executions of the task)

like image 31
luca Avatar answered Nov 11 '22 18:11

luca