25

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1187636
  • 251
  • 1
  • 3
  • 3

6 Answers6

22

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

Toddius Zho
  • 624
  • 6
  • 12
7

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.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
6

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)

abarisone
  • 3,707
  • 11
  • 35
  • 54
luca
  • 3,248
  • 10
  • 66
  • 145
5

refer link: http://www.testingjournals.com/5-must-know-features-thread-group-jmeter/

scenario 1 :

number of threads = 20
Ramp-up period =100
loop count=1

Every 5 seconds(100/20) 1 request/thread will hit the server,Execution will start with 1 request at a time

scenario 2 :

number of threads = 20
Ramp-up period =100
loop count=4

Every 5 seconds(100/20) 4 request/thread will hit the server, once the 1st request/thread completes , it will start 2nd loop by executing same HTTP request,Execution lasts until all 20 threads executes all HTTP requests 4 times

ZOU Zhiyuan
  • 145
  • 3
  • 8
1

My understanding of Ramp-Up is that a value of 0 will fire all threads at the same time (concurrently).

You might be able to achieve what you want by setting the following:

  • Number of Threads: 10
  • Ramp-Up Period: 0
  • Loop Count: N

and then using a Controller to determine when to end each loop.

Jamie Piltz
  • 205
  • 1
  • 3
  • 12
1

Yup, the Loop Count parameter is not intuitive. From what I figured out it is actually the number of times the thread/user performs a particular test

So if I understand correctly your intention that you want:

  • to run N number of concurrent threads/users
  • each of them sends a request every 10 seconds
  • you want to run this scenario for around 30 seconds

the configuration should be the following:

Number of Threads: N

Ramp-up Period: 0

Loop Count: 3

And in Constant Throughput Timer (within the Thread Group) you should set Target Throughput (samples per minute)=6, which means request every 10 seconds

v0rin
  • 510
  • 4
  • 11