JMeter delays takes longer than they should - jmeter

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

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.

Load Testing of UI User scenario - Jmeter Webdriver sampler

I want to run basic load testing scenario on a mendix application.
The initial requirement is at least 10 users should be able to perform some activities like login , file upload concurrently.
I have used the webdriver sampler in Jmeter with selenium and written the JS script for the actions.
The issue is it launches 10 browser on the same machine.
Please suggest the proper way to handle this. Currently it seems that the errors which I am getting are because of I am running the test on my laptop instead of distributed setup.
Also the total script takes 60 seconds to finish for single user. What should be the ramp up time?
If not Jmeter, please suggest any other suitable tool for this scenario.
As per The WebDriver Sampler: Your Top 10 Questions Answered article
Q. How do I Allocate the WebDriver Sampler?
A. First of all, don’t use the WebDriver Sampler to create the load! You’ll need around 1 CPU core per virtual user to keep the JMeter resource consumption within an acceptable range. The WebDriver Sampler should be used in addition to HTTP Request Samplers. Here’s an example of how it should be used:
1,000 of users are simulated by HTTP Request Samplers
1 user is the WebDriver Sampler
You should use the WebDriver Sampler to evaluate a real-life user experience. It’s most commonly used to measure the load times of pages when the system is experiencing high loads. The HTTP Request doesn’t really “render” the page and it can’t execute JavaScript. That’s why the WebDriver Sampler is so valuable - JMeter isn’t a browser and it overcomes limitations posed by this fact.
So first of all I would recommend re-considering your approach and migrating to HTTP Request samplers, you might be able to execute 10 browsers but if you will need to scale your test to 100 or 1000 users you will definitely won't be able to use this "real browser" approach while HTTP Request samplers act on HTTP protocol level, given you properly configure JMeter it will be no difference for the application under test whether the requests are originating from JMeter or from the real browser and the resources footprint will be much less.
With regards to the ramp-up time: the overall idea is to increase the load gradually so you could correlate the changing number of virtual users with changing metrics like response time, throughput, etc. According to JMeter Documentation:
The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.
Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).
Start with Ramp-up = number of threads and adjust up or down as needed.

How to generate number of requests per second for one user

I am trying to configure a test for signup-login with invalid credentials imitating bruttforce attack. However, I want to make requests as a single user.
So the scenario is the next:
Request to sign up with valid params;
Attempt to log in with invalid params in a loop.
I am adding throughput timer but then I need to set up a high number of threads to generate for example 1 request per second.
How can I set exactly one user and run only one request per second in a loop?
UPDATE - SOLUTION
Everything was rather simple but still strange for me.
Maybe someone will face the same problem.
To get a number of requests per one user throughput timer should be placed not inside the controller but inside the thread itself.
To achieve Target Request Per Second use Throughout Shaping Timer : How to use Throughput Shaping Timer
JMeter Plugin link : Download from here
Few Important Notes:
JMeter threads of Thread Groups in scope of the Element will be
stopped when RPS schedule finishes.
Provide enough working threads for your RPS, JMeter timers can only delay threads (and limit RPS). You may pair this plugin with Concurrency Thread Group using Schedule Feedback Function to dynamically maintain thread count required to achieve target RPS.
If you're using versions of JMeter lower than 3.3 and if you have RPS that lower at the end of test, make threads to lower also. Оtherwise you'll have a spike in last second.
Avoid using zero RPS value as start of test, this produce spike also
Avoid zero RPS during the test, this may lead to nasty effects
Now, practical example showing 1 RPS for 1 User:
You might want to reconsider the location of the timer, it obeys JMeter Scoping Rules so it gets applied to all Samplers which are in your Thread Group.
If you want to apply it to only one - make it a child of the relevant sampler.
Also be aware that Constant Throughput Timer is precise enough on minute level so you might want to switch to the Precise Throughput Timer

JMeter - how to simulate polling with multiple URLs

In JMeter, I can load test many pages using a random variable:
/path/item/${random_var}
I would like to hit each page X number of times (or until a condition is met). I would also like to wait (e.g. 1 second) in between requests for a specific page (it's fine to have concurrent requests for /path/item/1 and /path/item/2).
Any guidance on setup for that is much appreciated. I can answer clarifying questions if needed.
Add a Constant Timer as a child of this request and set Thread Delay to 1000.
Timer will be fired before each request therefore you will get a 1 second delay between next call. Sleep time will not be added to sampler's response time (unless you are using Transaction Controller configured to do so)
See A Comprehensive Guide to Using JMeter Timers for more information on above and other Timers and their use cases.

Something like thread.join in JMeter?

I have a jmeter test with about 50 users. the beginning of the test performs a login and some set up stuff. I don't want this all to happen at the same time as there would be way too much contention for a part of the test I am not interested in. So I have a ramp up period of 10 seconds. There is then one specific HTTP request where I want the 50 users sending over 1 second interval i.e. a HTTP request every 20 ms. This is to ensure the 50 users are excuting this part concurrently. Ideally, something like a thread.join() after the login / ramp up would help out here, followed by another guassian timer.
Is there something similar to thread.join() in jmeter?
To mimic thread.join you can use a Synchronising Timer, this will block n threads until they reach a point and then execute them all at the same time.
If you want this request load of 1 every 20ms to continue (rather than a single burst) then you can use a Constant Throughput Controller to define the actual rate of requests you want JMeter to run. You can configure each thread to run at a rate of 60 requests per minute and this will give you one hit every 20ms (based on 50 threads with response times always less than 1 second). You can also tell JMeter to just make sure your load is 1/20ms no matter how many threads you use and it will dynamically adjust. This option is perhaps more useful in the context of load testing.
Note. When using a CTT controller, you would probably want to put the login request either in a Once Only COntroller or in a setup thread group.

Resources