Jmeter - concurrency and events generation - jmeter

I have a data model JSON object which has 900 events sampling at 1-second intervals. I have to split these 900 events into 60 events fragments, send 60 events at particular reps once these 60 are done next 60 should be sent for the same users.
how can I achieve do I need multiple concurrent thread?

For sending data in chunks of 60 "events" you can use Synchronizing Timer with "Number of Simulated Users to Group by" set to 60 and a Thread Group with 60 threads (virtual users)
For extracting data out of the JSON data model you can use HTTP Request sampler with file protocol like:
it will return the full content of your "data model" file as the response and you should be able to extract "events" using JSON Extractor or JSON JMESPath Extractor

Related

Send n requests divided in batches with delay between each batch in JMeter

I have scenario where I need to send 2k,5k and 10k POST requests via JMeter ( creating new 2k, 5k and 10k entities ) but with delay of 5 seconds for each 100 sent POST requests.
So the ideal scenarios would be this:
Thread group ( Number of Threads(users): 5 and Loop count: 400, 1000 and 2000).
After every 100th sent requests ( sum of all 5 threads to have completed 20 requests each ) to add delay of 5 seconds before another 100 requests should be called.
It sounds you're looking for the Synchronizing Timer, if you set the Number of Simultaneous Users to Group by to 100 - JMeter will wait until 100 threads (virtual users) are available and then release them at exactly the same moment.
5 seconds delay can be added either using Constant Timer or by Flow Control Action sampler
More information: A Comprehensive Guide to Using JMeter Timers
One easy approach to accomplishing batched requests (or any type of requests with delays in between) is by using plugins from the JMeter custom thread groups.
In particular, the Ultimate Thread Group provides an easy tabular and graphical/visual representation of request profiles that is easy to tune:
As shown in the above screen shot, you can specify the number of requests and timing by entering a few simple parameters into the "Threads Schedule" table. The graph will show how your requests will be made over time. In this case we are running batches of 100 requests with just over a minute delay in between these batches.
The custom thread group plugins can be added using the JMeter Plugin Manager, and once added will appear in the "Thread" submenu as selectable thread groups when building your test plan:
Thank you #Lemonseed and #DimitriT for replies. I've found the solution based on answer from #Dimitri T on some other topic.
He proposed to add JSR223 Timer to request. So that's what i did in my case and it worked for me.
Here is the code that I used for my case:
if (Integer.parseInt(vars.get("counterForDelay")) % 100 == 0 ){
return 10000;
}
Where 'counterForDelay' is a counter that I added for Thread Group and "% 100 == 0" is where I check is the counterForDelay dividable by 100 with remaing of 0 (zero) and if that's true, add sleep of 10 seconds before continuing to next request.

How to setup a throuput whereby we have mulitple different request in time interval using jmeter

I have the following scenario. So I have an OS process sample that will send a request to the console app and wait for the process to finish, I want to control the request to be line 6 Request in an hour.
So send 1 Request wait 10 min send another request wait 10 mins...at 20 min point after the first request send 2 requests (could have a wait time of 30 seconds) in between the request then at the 40 min mark have another request. I have been reading about precise throughput timers but I am not new to Jmeter so trying to get some help if possible.
1 request of 5k at : xx:00 min
2 requests ( 1 each of 2k, 5k ) at : xx:20 min ~
1 request of 2k at : xx:40 min -
1hr no activity
repeat steps 1-4 a few ( 3 ) times
There is no way to run requests with different throughput values within the bounds of a single Thread Group, the overall throughput would be the speed of the "slowest" request.
All JMeter timers like Constant Throughput Timer, Precise Throughput Timer and Throughput Shaping Timer are trying to spread the load evenly during the throughput period.
So your load pattern can be implemented only using Constant Timers or Flow Control Action samplers, whatever is more convenient to you.
Something like this:
You can use Test Fragments and Module Controllers to avoid copying and pasting the requests

send one request that send every 10 minutes just for one sampler in thread group

How can I use if in GROOVY to write a condition for a request so that a request is sent every 10 minutes? I used the constant throughput timer, but this module was applied to all sampler in the thread group.

How to handle TPS in JMeter / Load Runner

I have an HTTP request which contains messages (json body). I need to achieve 1000 messages/sec throughout the load test. But I also need to randomize the number of messages (with different combinations like 100 messages in one HTTP Request, 200 and 300 etc.). Could anyone please let me know how can we achieve this in JMeter or Load Runner? My concern is that at any point, the maximum number of messages sent should not exceed 1000/sec.
To control message rate, you can use Throughput Shaping Timer
To send different type of messages you can use a CSV file and use component CSV DataSet to load it and read each line as a message into variable (let’s say you call it varName) which you can then use as ${varName} ad body of Http Request
1000 messages/sec throughout
LoadRunner - cannot be done (you can try to achieve this using Pacing but anyway it will mostly depend on your application response time)
JMeter - you can use one of the following:
Constant Throughput Timer
Throughput Shaping Timer
Precise Throughput Timer
Random number of messages in the request body payload: in both tools you will have to write some code for this, in LoadRunner you basically have to write the code for everything, in JMeter you can add JSR223 PreProcessor and use Groovy language for message payload creation
Not sure what a message means exactly in your requirement. But generally in LoadRunner you can create goal-oriented scenario and set the goal definition like average hits per second or average throughput (bytes/sec).

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