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

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

Related

What jmeter configuration I should use when running load test of 25 threads

I need to run a load test of 25 threads, what will be the most efficient configuration to use? (ramp-up period....). I ran the load test with the below configuration and some of the threads failed but pass if I just ran the script individually.
Your configuration will mean that:
JMeter start with 1 thread and add another thread each 4 seconds
Once started each thread will begin to execute Samplers upside down (or according to the logic controllers)
When the thread executes the last sampler it will be shut down
When the last thread executes the last sampler the test ends
Depending on the number of samplers and application response time you may or may not achieve 25 users concurrency, you might want to check the actual number of concurrent users using Active Threads Over Time listener
If you want to make sure to have 25 online users set "Loop Count" to Infinite and "Specify Thread Lifetime" duration to be more than your ramp-up period. See JMeter Test Results: Why the Actual Users Number is Lower than Expected article for more details.
With regards to the failures - we cannot state anything meaningful without seeing request and response details, make sure to save them using i.e. View Results Tree listener and inspect response body for the failed requests

How i can be sure that JMeter is not using the same sample more than one time at same time?

I'm using JMeter to test my applications, and I desire to use the same sample N times.
For example, lets say I have 100 different samples how I'll use to test my Login, and want to use these samples 10 times.
I'm using 100 threads, and 10 loops for that.
How I can be sure that the second loop using a sample will start just after that the first loop of that sample has finished (and not have the same sample running simultanious)?
I'm having some troubles to understand how JMeter lead to this scenario.
JMeter acts as follows:
Each thread (virtual users) executes Samplers upside down (or according to the Logic Controllers)
When there are no more Samplers to execute:
-if there is > 1 loop in the Thread Group - the thread starts executing Samplers once again
if there are no more loops to iterate - the thread is being shut down
You can track which thread is executing which sampler by adding __threadNum() function to the sampler name. The Thread Group iteration can be tracked by adding the special JMeter Variable ${__jm__Thread Group__idx}
If you don't want user 1 and user 2 to execute sampler1 at the same time - put this sampler under the Critical Section Controller, but in this case you will not have any concurrency.

Number of execution samples

i am running a simple test with 10 users for 5 mins. my test has a single thread and different transactions within it. By the end of the test, there is a different number of samples for each transaction. Is there a way or a setting so that we don't start any new thread when the test is finishing, i tried ultimate thread group plugin with ramp down , hoping to see same samples for all requests but it didn't happen. Not sure if that is even possible.
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers)
When you're defining test duration it might be the case that some virtual users are somewhere in the "middle" of the Samplers and they stop when they receive shutdown signal.
It means that the very first sampler will be executed with 100% of users and for further samplers the chance of getting executed becomes lower and lower.
The only way to have the same number of Sample Results for all Samplers is using normal JMeter Thread Group and providing fixed amount of loops.
Given above setup you will have strictly 80 executions of each and every Sampler in the Test Plan
More information: Getting Started with JMeter - A Basic Tutorial

How does jmeter thread group process samplers?

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.

How can i make jmeter run all thread group before repeat?

I have a thread group with 2 http requests, the first one is for the user to log in and have two regular expression extractor so I can extract the credentials.
the second http request should use those credentials in the header.
This is all working except that jmeter is executing all login requests, and after that executes the second request.
I was expecting the login request to execute and after that the second request, and then repeat the whole thing.
Any sugestion?
If you just want to repeat your test flow set in Thread Group
Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
Number of Threads = 1 and Loop Count with the number of times you want to repeat.
This way you will execute the samplers sequentially.
If you set Number of Threads above 1 it will execute test flows in parallel, if you need it you will have to use Synchronizing Timer.
The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and then they are all released at once.

Resources