JMeter: each sampler is taking 100 ms - jmeter

Im using JMeter for stress testing. Im sending requests in a continuous loop. Actually Latency / Elapsed time shows only 10 ms., but JMeter is not executing the next sampler for another 100 - 120 ms., which is resulting in a delay.
I really wonder if each sampler takes so much time for preparing to be executed. Also, generally pre and post processor dont get logged into results csv., so the sample elapsed time included their execution time as well?
Appreciate the help
Test Plan
TestPlan
Setup Thread Group
Thread Group 1
Random Variable
User Defined vars
Loop1
Http Request1
Header Manager
Post Processor (My Own, it really improved performance compared to BeanShell / JSR223)
Http Request2
Header Manager
Constant Time wait (50ms)
Loop2
Http Request1
Header Manager
Post Processor (My Own)
Http Request2
Header Manager
Constant Time wait (10ms)
Thread Group 2 #not used at the moment
Thread Group 3 #not used at the moment
Teardown Thread Group
In the Above plan., there is no sleep or anything between HTTP Request 1 & 2., still it is taking 115ms
Thought there is a wait after HTTP Request2 in each loop it is just 10 ms, here it is taking 125 ms.
Thanks,
Rao

Timers are not well understood by JMeter users because they have an odd behavior as stated by the documentation:
Note that timers are processed before each sampler in the scope in which they are found; if there are several timers in the same scope, all the timers will be processed before each sampler.
I suggest you to use the Test Action to simulate delays as its behavior is easier to understand. Define its duration as the delay you want to simulate and you are set.

Related

Jmeter HTTP Request: how it really works

I have executed couple of Jmeter tests so far. My test plan in very basic one. I'm using Jmeter 5.2 on mac environment.
Number of threads: 500
Ramp-up period: 1
Loop count 3
[x] Same user on each iteration
[ ] Delay thread creation until needed
[ ] Specify thread life time
Basically according to my configuration above, the test will have 500 different threads being spawned in my JVM while this load test is running.
In order to create 500 threads, Jmeter has time restriction of just 1 second only. So, it will create the one thread in each 0.002 seconds from the moment I start the test.
I'm just hitting to an deployed publicly available service with HTTP POST request with a valid payload.
Now my real question
It is possible that the very first request that Jmeter sends will get the response from the server in just 0.2 seconds(200ms). What happens to that thread from that moment? Will this thread being killed after that?
Ramp up period doesn't stop thread, setting Duration will stop(/kill) thread if reach duration time,
Each thread execute independently until it finishes his last loop,
So in your case each thread will end after ~0.6 seconds (0.2 second per request * 3 loops)
It is possible that the very first request that Jmeter sends will get the response from the server in just 0.2 seconds(200ms) - yes, it may be even less, the question is whether your application can respond in 200 ms or less
What happens to that thread from that moment? Will this thread being killed after that? - for particular your set up if there are no more Samplers to execute the thread will execute this HTTP Request sampler 2 more times and after that it will be asked to stop.
You can increase JMeter logging verbosity to whatever level of details you want and inspect jmeter.log file in order to get the idea regarding what's going on under the hood of JMeter. Basic details can be obtained without any configuration tweaks:

JMeter delays takes longer than they should

I am using JMeter in order to test some environment. I build a thread group in JMeter that includes a couple of https requests with a delay between each of them.
somthing like this:
1. https request
2. random delay
3. https requst
4. random delay
6. https requst
7. random delay.
But for some reason the delays take much longer than they should and the test take much longer than it should (a delay of only 3 seconds or 3000 milliseconds takes 13 minutes). I try switching the random delays to constant ones but it still takes longer.
I tried searching online for a reason but I couldn't find a clear answer.
You should put the delay level under the request so it will impact only a single request,
Currently each delay affecting all the requests in the same level and that is causing the inconsistency
See JMeter's execution order
The only reason I can think of is that your test setup violates JMeter Scoping Rules
If you design your test like this:
All 3 timers will be executed before each request so instead of 3 seconds of waiting time after sampler you will get 9 seconds of waiting time before each sampler
If you want to apply a random delay before each sampler - leave only one timer.
If you want to apply different delays before each sampler - make timers children of the respective samplers:
If you want delay after the sampler instead of before the sampler - use Flow Control Action sampler instead of timer

Set time gap/timer between 'foreach controller' requests in Jmeter

Set time gap/timer between 'foreach controller' requests.
We have a below scenario:
Login single user>click question multiple times
To achieve above scenario in Jmeter used below Test Plan:
ThreadGroup - 1 user, 1 ramp up period, 1 loop
-HTTP request to login
-Questionslist - RegExp to get list of questions with -1
-ForEach Controller - 100 times loop count
--HTTP request
When 'Timer' is set under 'ForEach controller' doesn't actually considered this timer value (ex: 2000 milliseconds)
Please guide how to have time gap between 'ForEach controller' http request.
Actually Constant Timer should work however you will not see this delay anywhere as by default the duration of PreProcessors, Post-Processors and Timers is not included into Sampler time.
You could put your HTTP Request and the Timer under Transaction Controller and configure it to:
Generate Parent Sample
Include duration of timer and pre-post processors in generated sample
This way you will get Timer time (2 seconds) added to your Sample Result.
However above approach is on per-user basis, it means that each virtual user will have a 2-second delay between HTTP Request. If you would like to have 2 seconds of absolutely idle time, i.e. when no requests are being made at all you can add a Test Action sampler after HTTP Request sampler and configure it to produce a 2000 ms delay. Also put Synchronizing 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 virtual users in Thread Group - this way Test Action sampler will act as a rendezvous point and all the virtual users will "meet" there to "sleep" together for 2 seconds.

Can jmeter send request more expected samples?

-I has a request for post data to server.
-I config Jmeter with info :
Number of Threads(users) : 16
Ramp-up : 1 and check forever
I run jmeter about 15 minutes(900s) and stop.After,i view report and see report display about 45000 samples .
=> I think only 14400 samples expect for 15 minutes but display more samples.
So,Can jmeter run more samples (> 16 thread in 1s) although i config 16 threads in 1s ?
Thanks,
JMeter tries to execute samplers as fast as it can, each thread sends request, waits for response, sends another request, etc.
You will get 14400 samplers only if response time for each sampler will be exactly equal to 1 second. If response time is less than one second - you will get more samplers executed within the given timeframe and vice versa.
If you need to throttle JMeter execution rate to 960 requests per minute (16 requests per second) you can use one of the following elements:
Constant Throughput Timer
Throughput Shaping Timer
Be aware that both timers are capable of only pausing JMeter threads to limit the load to the defined factor, they won't be able to kick off any extra threads to reach the target throughput in case if current is too low.

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