Jmeter Request Execution - jmeter

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.

Related

JMeter - How to handle Long polling transport request method

In my Jmeter script request which contains the 'LongPolling' transport method and it takes a high load time or response time
Also, the response message content value is used for the next consecutive request. How can I handle that scenario?
I don't want this my wait time for the server response
JMeter thread model assumes that a thread (virtual user) always waits for the previous sampler to fully complete before starting the new one.
The easiest solution is moving your "long-polling" requests into a separate thread group and if you need to pass data between thread groups either use __setProperty() and __P() functions combination or go for Inter-Thread Communication Plugin
If you need to have everything within the single Thread Group - you can consider using Parallel Controller, however it might not be fully suitable for your needs as it is still a Sampler hence it waits for all its children completion prior to proceeding
Depending on your use case you can find jmeter-asynchronous-http plugin useful, see How to Load Test Async Requests with JMeter article for more details if 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 number of threads in a run

I am quite new to jmeter and try to do a performance test of my application. I want to generate 100 request per second scenario however my server takes 3-4 secs to respond to every request. I am running my test for 1 mins which means number of requests fired should be 60k within the time span. However jmeter actually waits for the response before it sends next request. Which is not what I am looking for.
How can I make sure that jmeter sends a new requests every second with 100 req/sec without waiting for the response so that the number of requests fired per min is 60k.
I am trying to use constant throughput timer with 60k as request per min, however that is not helping. Here is my test screenshot.
EDIT
I have done like this
And Throughput shaping timer being as
So ideally I should get number of samples as 3000?, still not getting that.
Make sure you provide enough threads (virtual users) under Thread Group, "vanilla" JMeter won't kick off any extra threads if actual throughput is less than target one you specify in the Constant Throughput Timer.
Another solution would be using Concurrency Thread Group along with the Throughput Shaping Timer. They can be tied together via feedback loop so if you use these test elements JMeter will start more threads if the current amount won't be enough to reach the desired requests per second rate.
You can install both using JMeter Plugins Manager
My suggestion is to consider using the Arrivals Thread Group. This TG will allow you to configure the desire average throughput (ATP); the TG will instantiate the required threads needed to achieve the ATP goal.

How to make jmeter reach target throughput or fail trying?

I have a very simple web service and I'm trying to measure its latency metrics under different throughputs -
If the system under test can't handle the target throughput, I want Jmeter to keep the same throughput, even if a lot of requests fail.
I tried implementing this using a large number of threads and a constant throughput timer, but Jmeter tended to simply not reach the target throughput instead of requests failing.
Any recommendations?
Constant Throughput Timer has 2 main limitations:
It is accurate enough on minute level so you need to ensure that your test is running long enough (minute or more). Also its effect is not immediate so during 1st minute of your load test you need to control virtual users arrival rate using Ramp-Up Period setting on Thread Group level
Constant Throughput Timer is only capable of pausing the threads to limit their execution rate to the "target throughput", it will not be able to kick off any extra threads so make sure you define enough virtual users again on Thread Group level
Given Web service == HTTP transport and HTTP being stateful protocol (each JMeter thread (virtual user) will wail for response from the previous HTTP Request sampler prior to starting next one you can speed things up by defining a timeout for your HTTP Requests so they would fail earlier. The best place to put the timeouts is HTTP Request Defaults, this way you will be able to do it in a single shot for all HTTP Request samplers in scope
You may also want to try Throughput Shaping Timer which is a little bit enhanced version of the Constant Throughput Timer.

Run Multiple requests of single thread group concurently

I want to simulate a scenario in which a page contains multiple requests for differ data. All runs concurrently. I created a Thread Group with all those requests and ran it for 10 users(Threads) in 0sec ramp up time. But in this Test Plan all users starts concurrent but they all process requests in sequential way i.e.(always completes first request then starts 2nd,then third,so on).
I want that all requests of each user starts at same time then completes according to their response time (Like if 3rd takes less time than first then it should complete before 1st and 2nd). I have tried Synchronize time.
I don't think it is possible at the moment, the relevant enhancement is being tracked as Bug 53159
In the mean time you have 2 options:
Use different Thread Groups to kick off the requests. If you need to synchronize the requests you can use i.e. Inter-Thread Communication plugin.
Develop some custom code using JSR223 Sampler or even create your custom sampler, see How to Load Test AJAX/XHR Enabled Sites With JMeter for details on how this can be done.

Resources