Jmeter Threads not executing independently - jmeter

I am using jmeter 4.0 to simulate android app.
the app generate data upload to server.
jmeter script is like.
Thread Group -> 13500 threads rampup : 20min
|->once only controller
|->Simple controller
|->HTTP Request(get number of uploads)
|->JSR223 Sampler (parse response,set up loop var)
|->Loop Controller
|->JSR223 Sampler (generate data)
|->HTTP Request (send data)
|->Take Action Sampler
|->Constant Timer
When script is executed. At first it execute all the once only controller of all the threads then HTTP request for all the threads. So on.
Jmeter is executing each sampler for all the threads then procedding to the sampler.Threads execution is not independent.
I am printing the logs to the console from JSR223 Sampler.

No that’s not what is happening.
You think it is most probably because you start all threads at same time.
In Jmeter all threads run independently.
Add a slight delay using rampup field so that threads gradually start and you’ll see.

Related

How to wait all threads to complete a Sampler before starting its Post Processor

I have 2 samplers with JSR223 post processors in each. I want threads to wait before starting the Post Processor.
If there are multiple threads are running the sampler, I want to start the Post processor execution after all the threads complete the sampler.
Please let me know how to do this.
You won't be able to achieve this using JSR223 PostProcessor as all JMeter threads (virtual users) are absolutely independent and will start the PostProcessor as soon as sampler will be completed.
So I would suggest amending your test as follows:
Sampler 1
Sampler 2
JSR223 Sampler
Synchronizing Timer
The Synchronizing Timer will act as a "rendezvous" point so this way you will be sure that all threads have finished Samplers execution and will start your JSR223 Sampler at exactly the same moment.
If you don't want JSR223 Sampler to generate Sample Result - add SampleResult.setIgnore() somewhere in your script.

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

There are 5 Parallel request executing in under 1 TR controller of Jmeter

Let,c These below are the 5 request in one Transaction controller
https//detailslist/Json/1
https//detailslist/Json/2
https//detailslist/Json/3
https//detailslist/Json/4
https//detailslist/Json/5
Note : Above request are executing parallel in browser and the response time of the browser is one of the highest response time of the request (request 4 is having high response time i;e 6 sec and this is the total response time of this page)
In Jmeter what is happening, It is giving response time sum of all 5 request i;e 12 sec.Which is higher than browser.
How we can do this in Jmeter. is there any solution or option are available in jmeter to execute request parallel in jmeter.
Thanks in advance to people who will answer.
JMeter executes sequentially samplers under Transaction Sampler.
There is an enhancement request for that but I am not sure it will be implemented one day:
https://bz.apache.org/bugzilla/show_bug.cgi?id=53159
To do this , you would have to code a JSR223 Sampler using groovy as a language for example.
Currently JMeter cannot kick off any extra threads to simulate the behaviour so the options are in:
Write your custom sampler which will kick off several parallel threads from JMeter Thread
Use scripting-enabled sampler like Beanshell Sampler or JSR223 Sampler
See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for more detailed explanation and some reference code for points 1 and 2

Running sampler of jmeter in isolation

Suppose my threads are 30 and iteration count is 1 and I have samplers such as:
sampler1
sampler2
sampler3
....
sampler10
Whenever I run the test plan with corresponding ramp up period some of my samplers are being executed concurrently I meant user 1 is executing sampler1 and also user 20 is executing same sampler which is absolutely fine but I want sampler3 to be executed in isolation i.e. when that sampler is being executed by someone no other user should try to access it.
Is there any way?
I am using Jmeter.
Thanks in advance
As per Using the HTTP Cookie Manager guide you can put your Sampler 3 under Once Only Controller
From documentation
The Once Only Logic Controller tells JMeter to process the controller(s) inside it only once per Thread, and pass over any requests under it during further iterations through the test plan.

Jmeter Request Execution

I am trying to understand jmeter's core behavior.
Say I am executing a HTTP request (single user and single sampler but different variable values) in infinite loop.
In the above case does jmeter send a request and waits for the response before sending the next request OR it sends the requests without waiting for response?
Jmeter uses a thread-based model where each thread will wait for a response before sending another request. In other words it will only drive the load as fast as application can take it.
In JMeter you specify a number of threads in a ThreadGroup which equate to virtual users, and the threads attempt to execute the script as many times as possible.
If you want to maintain a constant rate, you can use multiple threads and use a Constant Throughput Timer to set the request rate: if there are enough threads, it should be possible to maintain the rate even though some threads are waiting for a response. Here belongs also custom Throughput Shaping Timer which is more flexible.
Another possibility seems to be to use e.g. either Ultimate Thread Group or Stepping Thread Group from jmeter plugins.
In this context you can also look onto the Response Timeout field available for any jmeter's sampler - number of milliseconds to wait for a response.

Resources