Confusion in choosing delay between Iterations - jmeter

My goal is to give exact 5000 milliseconds delay between Iterations.
Below are 2 approaches I have followed.
Approach #:1 :ThreadGroup>Add TestAction>Add JSR223 Timer (see the below screenshot).
I am very clear on approach #1 and i can see the below lines in the jmeter.log(5000-Prev gettime)from this i got confirmation delay between Iterations working.
2017-08-21 16:23:08,260 INFO o.a.j.t.JSR223Timer: 4831
2017-08-21 16:42:37,871 INFO o.a.j.t.JSR223Timer: 4835
Approach #:2 : ThreadGroup>Add TestAction (see the below screenshot).
After I executed the test in the jmeter.log, i couldn't find any number indicating delay between Iterations.
My Questions:
1.For the 5000 milliseconds delay between the iterations which approach should i follow Approach #:1 or Approach # 2.
2.If i use Approach #:2 as is how can and where can i cross check 5000 milliseconds are applying for each Iterations.
3.Is Approach #:2 correct i mean to say am i missing anything?
Please advise me! I am soo confused.
Thanks,
Raj

Your Approach #1 is flaky as
Delay between requests will always be less than 5 seconds
Assuming this JSR223 Timer position the delay is applied to all samplers, if you want all threads to sleep for 5 seconds at the iteration start you need to add it as a child of the first sampler. References:
Scoping Rules
A Comprehensive Guide to Using JMeter Timers
Your Approach #2 is fine.
Where do you expect to see evidences of the delays? JMeter log won't contain any lines indicating the sleep happened and .jtl results file will neither show Test Action sampler result(s) nor JSR223 Timer (unless you put your sampler under a Transaction Controller in "parent sample" mode configured to store duration of pre/post processors and timers).
The only way to see the "sleep" works is running your test 2 times: with and without "sleeps" (better with 1 virtual user), the total duration of the test with "sleeps" enabled should be 5 seconds longer.

Related

Does the Constant Timer added in my HTTP Request affect the results in the Summary Report?

I have a HTTP Request in my Thread Grpup that takes around 20 to 30 seconds to complete with a single user, so when I added 50 users I get a 500/Internal Server Error or 503/Server has been shutdown sometimes.
I want to add a Constant Timer with 40 seconds (in miliseconds) under the HTTP Request so maybe the application will have some time to process it. I am going to the rigth way?
If I add the Constant Timer will it be calculate as well in the Summary Report?
I need that the Jmeter give the time to the API (My aplication) complete the process (need at least 30 seconds) and it may be or not affetct my Summary Report
PreProcessors, Post-Processors and Timers are not counted in the Elapsed time. so response time will not be impacted.
However Throughout (the number of requests for the test duration) will be lower.
See JMeter Glossary for more information on the above metrics.
With regards to "right way" - real users don't "hammer" application non-stop, they need some time to "think" between operations so if you're simulating a real user you should have non-zero think time, however 40 seconds it kind of too much for me. Take a look at How to make JMeter behave more like a real browser article for more tips on properly configuring your JMeter test.

I am not able to get Precise Throughput Timer working

I don't know if I have placed the timer at the correct location. I am not able to get Precise Throughput Timer working.
Any JMeter component needs to be placed according to JMeter Scoping Rules
How do you expect the timer to "work" given you have only one thread and one iteration in the Thread Group especially given your test finishes in 500 milliseconds and you configured the test duration as 500 seconds
If you want to limit your test throughput to 1 request per second for 1 thread and 1 iteration only - I can only think of introducing pacing as none of the existing timers won't be able to do this given that short test duration

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

JMeter: delay between each thread request a sampler

I am working on stress test, but my first sampler floods server with tons of requests with very little amount of time, so I want to make a delay between each thread using request.
Test structure:
Thread1 - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread2 - Sampler1 (for example: access login form)
Delay (custom seconds)
ThreadN - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread1 - Sampler2
Delay (custom seconds)
Thread2 - Sampler2
Delay (custom seconds)
<...>
Synchronizing Timer
All threads realeased with final sampler (this part works)
I tried to put timers as samplers parents or childs. Probably I am missing something, because non of the timers are working for me.
I've found similar problem solutions, but non of the worked for me:
JMeter - sharing a delay between requests across multiple ThreadGroups
Delays for each thread in Ultimate Thread Group
I would suggest using the stepping thread group via http://jmeter-plugins.org/wiki/SteppingThreadGroup/.
In the 'thread scheduling parameters' section, you'll note you're able to specify the maximum number of threads to run at peak, but you're also also to slowly instantiate threads as you need them.
Very plainly, the setup below says "When I run this test, I'm eventually going to want 100 threads, but when I first start the test, wait 15 seconds, then only start 10 threads. Then add another 10 threads every 120 seconds. Once we reach max threads, keep working for 180 seconds, then slowly peel off 5 threads every 15 seconds.
This should meet your need.
As per your Test Plan description, you can use 1 of the timers mentioned below:
Gaussian Random Timer
Constant Timer
Hope this will help..
Constant Timer would be best option as per your mentioned requirement.
You can use 'Ultimate Thread Group' instead of regular Thread Group. There is 'Initial Delay' in ultimate thread group which will help you to achieve your requirement.

Loadtesting in burst mode in Jmeter

I am running my load test for a duration of 1 hour,in between the test I want a scenario to run for a duration of 1 minutes at regular interval of 15 minutes.
In jmeter,currently I am able to simulate for all the others scenarios except for the burst mode.
How do I keep the delay for 15 minutes and trigger the request for duration of 1 min?
How do I achieve the TPS for the burst? Currently I have to manually trigger jmeter script.
I would suggest doing the following:
Add a separate Thread Group.
Configure ramp-up and thread count as required.
Add a Constant Timer, set Thread Delay to 900 000 (15 minutes = 900 seconds, 1 second = 1000 ms)
Add a Runtime Controller, set Runtime to 60.
Add a Loop Controller, set Loop Count to Forever.
Place your burst test logic under the Loop Controller.
If you need to define requests per second rate during spikes use Constant Throughput Timer
I came here since I had the same issue or similar issue of "simulating" burst like request during the load test. I tried to follow the accepted answer but didn't get it to work (perhaps I misunderstood some steps), anyway; I based my solution in #esteveavi comment Loadtesting in burst mode in Jmeter from the original post above. And ended up using JMeter's "Ultimate Threat-Group" plugin with something like the following test plan set up:

Resources