How does jmeter thread group process samplers? - jmeter

I'm having a question about how the requests are processed,
For example:
I have created a test plan, with one thread group.
Set number of users (thread): 10
Ramp-up period: 20
Loop count: Forever
Within this thread group I have created 5 HTTP requests.
When I hit start, I understand that it starts with 1 user, and by 20th second it will have all 10 users.
Does each sampler (http request) get assigned to 1 user? Is each sampler fired in sequential order? Does it fire parallel requests? I am trying to understand overall working.

JMeter starts threads (virtual users) within the bound of the ramp-up period. In your case JMeter starts with 1 user and adds another user each 2 seconds.
When thread (virtual user) is started it starts executing Samplers upside down (or according to Logic Controllers)
When there are no more samplers left to execute the thread starts over (if the number of loops is > 1), otherwise it is shut down.
With regards to concurrency, it mainly depends on the number of threads and application response time, you can observe how many virtual users were online using Active Threads Over Time listener and the delivered load using Server Hits Per Second. The aforementioned listeners can be installed using JMeter Plugins Manager

Each thread is sequential firing HTTP requests based on your flow
But you are executing 10 threads/users in parallel, so the order of the requests in total isn't sequential, but parallel
If you defined loop count as 1, then each sampler (http request) would get assigned to 1 user,
But you are looping endlessly, so samplers can be executed more than once per user/thread
About Loop Count: (asked in comment)
Loop Count - the number of iterations for each Thread.

Related

How to provide jmeter thread group , Ramp up peridod and Loop count?

I'm new to jmeter I have the following scenario. I want the jmeter to hit the given url, I have 13 such url in a csv file.
I want to hit the url at the rate of 2 requests per second for a given time period of 60 seconds.
In this case how should I specify my thread group, Ramp-up period and Loop count.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user. But I'm not sure how to specify when we have 13 such urls.
Atleast any link for the given scenario is appreciated.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user
not necessarily, JMeter waits for response from the previous Sampler prior to executing the next one, the configuration means that JMeter will start 1 user each second, it doesn't guarantee 1 request per second.
The easiest way of achieving X requests per second throughput is using Throughput Shaping Timer
Make sure to supply the sufficient number of Threads, i.e. if your application response time is 1000ms - 2 threads should be enough, if it's 2000 ms - you will need at least 2 threads, etc.
There is a special thread group: Concurrency Thread Group which can be connected to the Throughput Shaping Timer via Feedback Function so it will automatically kick off extra virtual users if the current amount will not be enough in order to conduct the required load.

Simulating Surge/Burst Request with JMeter

I am trying to see if I can simulate a burst mode in JMeter (2.x -- that's the only version I have access in this particular environment and cannot upgrade) with a sustain load, and a fixed duration/flight-time at certain intervals.
For instance, I would like to flood the target with 4 separate thread groups of 80 users, every 30 minutes for around 5 continuous minutes. This is in addition to the existing main thread group that is making 200 simultaneous requests forever (24 hours+).
I tried this answer, however, I am not seeing the desire effect. My JMeter setup is as following:
- A main thread user group (200 users, 5 secs ramp-up, forever loop)
- It contains 4 separate HTTP Requests as its children (they get called as long as the script is not shutdown)
- 1st separate thread group with 80 threads, 5 secs ramp-up, forever loop; as its children:
- "Constant Timer" for interval invocation, e.g. every 30 mins
- "Runtime Controller" for duration/flight-time configuration, e.g. 5 mins continuously
- "Loop Controller" to iteratively executing the requests, set to forever loop (I even tried fixed numbers, e.g. 10)
- An actual `HTTP Request`
- 2nd separate thread group with identical setup except different HTTP Request
- 3rd separate thread group with identical setup except different HTTP Request
- 4th separate thread group with identical setup except different HTTP Request
I tried to play with Ultimate Thread Group but seems like it doesn't create a surge mode, but it does execute it for the set duration. The requests are uniformly distributed in that time period rather than being sent in burst mode to the target server. So it appears that it only subscribes to sending a number of requests equal to the number of thread counts for that duration.
What I want for those threads in these surge thread groups to continuously send requests for the entire configured duration, non-stop, similar to the main load thread group, rather than just sending X amount of requests (equal to the number of threads) once.
Is this achievable with
You might need to switch to a SaaS offering to support that many requests in parallel, such as https://rungutan.com
I don't think Constant Timer is the right option as it creates 30 minutes delay before each HTTP Request sampler in its scope.
If you want to wait for 30 minutes and then release all 80 threads at exactly the same moment:
Add Test Action sampler and configure it to "sleep" for 30 minutes
Add Synchronizing Timer so all 80 threads will "sleep" together as the child of this Test Action sampler
Add HTTP Request sampler which does the real job
Add the same Synchronizing Timer as the child of the HTTP Request sampler
This way you will get 80 users hitting your server each 30 minutes

Why JMeter Ultimate Thread Groups create incorrect number of users?

When I'm using the original JMeter Thread Groups and set 10 threads (users), it fires 10 external HTTP calls.
When I changed it to Ultimate Thread Groups (UTG) and set the following attributes...
Start Threads Count = 10
Initial Delay = 0
Startup Time = 60
Hold Load For = 30
Shutdown Time = 10
...it fires thousands of external HTTP calls. Even the Stepping Thread Groups (STG) and Concurrency Thread Groups (CTG) also behave the same as UTG.
Why this happens when using non-original JMeter thread groups? I'm looking for ways to create 10 users that create 1 external HTTP call each (means 10 in total for the whole test plan) using UTG, STG or CTG but I don't really understand why this happens.
Screenshots when using original Thread Group
Screenshots when using original Ultimate Thread Group
Your scenario results in:
On 5th second of the test 1st virtual users starts
Within next 55 seconds remaining 9 virtual users start
10 users are active for 30 seconds
Then each 1 second each 1 virtual user is being shut down
You're seeing much more than 10 requests because once virtual user is kicked off it starts executing Samplers as fast as it can and the actual number of executed Samplers will mostly depend on your application response time. Check out What is the Relationship Between Users and Hits Per Second? for more comprehensive explanation.
If your goal is to execute 10 requests in 1 minute 40 seconds you need to use Constant Throughput Timer or Precise Throughput Timer or Throughput Shaping Timer in order to limit JMeter to send 1 request per each 10 seconds.

Run same Jmeter thread group after certain interval

I am trying to run the same thread group after a certain interval. Example -
JMeter will run thread group A and execute all http requests inside it and let's say for example after 20 sec it will run thread group A again and this loop should carry on until I manually stop the script.
What I have designed right now is something like this-
Thread Group A
While Controller (I gave some condition so that it is always true)
Http request 1
Http request 2
Constant timer (20sec)
but this only puts 20sec delay between each http call.
Replace Constant Timer with the Test Action sampler, keep all defaults and set "Duration" to 20000 milliseconds
Add Syncrhonizing Timer as a child of the Test Action sampler and set "Number of Simultaneous Users to Group by" to be equal to the number of threads in your Thread Group
That's it, synchronizing timer will act as a "rendezvous" point so all your virtual users meet there and wait for 20 seconds together.
You might also be interested in How to Easily Implement Pacing in JMeter in order to be able to configure more complex delay scenarios

In JMeter, how to allow multiple threads to upload files concurrently

I have written a simple test plan with the following steps
Test Plan
View Results in Table
Aggregate Report
Thread group
Threads: 5
Ramp-up period: 0s
Loop count: 1
Inside Thread Group
A dummy sampler to prove that all threads are running concurrently
HTTP request to upload a file
When I run the above tests, the dummy sampler is executed nearly the same time. However, I realize that only 1 thread can execute the HTTP request to upload file at a time, even when I have multiple threads. So the final result will be Thread 1 upload file -> finish -> Thread 2 upload file ... e.t.c.
Is this a normal behaviour and can I make file upload performs concurrently from multiple threads?
It depends on the number of threads, loop count and ramp-up period. JMeter starts threads within the time frame you specify in "Ramp-up period" input and the threads start executing samplers upside down (or according to the Logic Controllers). When there are no samplers to execute or loops to iterate the thread is being shut down.
If you need to configure JMeter to execute a certain request at exactly the same time by several threads add Synchronizing Timer as a child of this request and configure "Number of Simulated Users to Group by" setting to match the number of simultaneous users
Example execution:
As you can see, Dummy Samplers were started in 2 seconds while HTTP Request samplers were executed at nearly the same moment.
See Using the JMeter Synchronizing Timer article for more information on implementing these "rendezvous points" in JMeter tests

Resources