How to achieve throughput of 10 samplers per hour with 1 thread - jmeter

I have to setup multiple thread groups to simulate prod usecase. For one of the scenario, I have to setup
Thread count: 1
Throughput: 10 per hour
To achieve this, in a thread group, I set "Number of threads" as 1, loop count as infinite and Duration as 3600.
I added constant throughput timer under flow controller.
In constant throughput timer, I can only set "Target Throughput (in samples per min).
I have only one HTTP request in the thread group, so I set Target Throughput (in samples per min) as 0.16 ( as 10/60 = 0.16).
But the moment I start the test, only one iteration executes, and the test stops.
Please guide me on how to set "Target Throughput" to meet very low throughput. I.e to achieve 10 samples per hour.

Since JMeter 4.0 there is a timer which better fits your workload model: Precise Throughput Timer
Example configuration:

Related

Throughput Controller and Constant Throughput Timer don't work together in different thread groups

In my test plan I want to send N requests per second (RPS), where:
20% from N I send to localhost:8888/api/journal (example address)
80% to localhost:8888/api/simulation
I use Throughput Controller to implement percentage and Constant Throughput Timer to send N RPS.
When my requests in single Thread Group - it works well. Test plan screen below:
But if I place my requests in separate Thread Groups - Throughput Controller doesn't work. Like this:
Throughput Controller config: Based on is Percent Execution and Throughput is 20.0.
Constant Throughput Timer config: Target Throughput is 600.0 and Calculate Throughput based on is all active threads.
2 similar Thread Groups: 4 threads, 1 rampup, infinity loop count, 5 seconds duration.
At first screen I get ~10 RPS and 80/20 percentage, at second the same ~10 RPS but 50/50
What's wrong with second configuration? Thanks.
jmx-file link - you can copy it (changed to the second test plan)
Summary of discussion in comments section.
This behavior seems unexpected and it's worth opening a bug with https://bz.apache.org/bugzilla/.
There are 2 workarounds:
Add additional request under Throughput Controller;
Set Loop Count to a finite number of iterations.

Controlling number of Samples in bzm - Concurrency Thread Group

I am trying to find out throughput of an endpoint using Apache Jmeter as testing tool.
I need to hit the endpoint at n threads(users) per second, and every thread should fire exactly one requests(sample).
For the above i configured bzm - Concurrency Thread Group.
Configuration One:
Target Concurrency: 100
Ramp Up Time(sec): 1
Ramp-up Steps Count: 1
Hold Target Rate Time(sec): 10
Configuration Two:
Target Concurrency: 1000
Ramp Up Time(sec): 5
Ramp-up Steps Count: 5
Hold Target Rate Time(sec): 60
What i expect is
a. Configuration One: only 1000 request must be fired in 10 sec.
b. Configuration Two: 60000 requests must be fired in 60 sec i.e 1000/sec.
As per your test case and test duration settings, I think, you are making confusion with the Threads and Requests.
Threads are virtual users. Threads and Requests aren't the same.
Ramp up is the time in which all the users arrive on your tested application server.
Requests are simulated by samplers but threads are the simulation of users.
Please note- The total number of requests are related to throughput, Whereas the number of active threads performing the same activity is related to concurrency.
You can achieve your requirements by using Constant Throughput Timer at your test plan level.
Constant Throughput timer allows you to maintain the throughput of your server (requests/sec). Constant Throughput Timer is only capable of pausing JMeter threads in order to slow them down to reach the target throughput. Also, it works only on a minute level so you need to properly calculate the ramp-up period and let your test run long enough.
Here are the workarounds:
Calculate the number of threads you need to achieve your target throughputs. Formula is:
RPS * max response time in second
Use the Ramp-up periods for the threads to active accordingly.
Make the loop count value to Forever
Set the test duration accordingly.
As Constant Throughput Timer works on a minute level, to achieve X RPS you have to configure your "Target Throughput" value to X*60/min and "Calculate Throughput based on" value as "All active threads".
For example, if you need 1000 RPS, then "Target Throughput" value should be 60000/min in Constant Throughput Timer.
Check out my answers on these threads to understand your scenario more briefly.
How should I calculate Ramp-up time in Jmeter
Struggling to maintain Requests per Second (RPS)?
Hope this helps!

How should I calculate Ramp-up time in Jmeter

There are many questions/answers available here to understand Ramp up time but I want to get something in detail for my test case.
Test Case : Expecting 1200 users per 5 minutes on the home page. So it will be like 5 users/second.
I have set following thread properties :
No. of Threads : 1200
Ramp-up Time - ? [I am not sure what to set]
Loop count - Forever
Scheduler - 300 Seconds[5 Minutes]
Can anyone please help me to set ramp up time for my test case? I am running the test on my local machine.
I want to check that how many users server can handle in 5 minutes. Our expectation is 1200 users.
As per you test case and duration settings, I think, you are making confusion with the Threads and Requests.
In short: You must use Ramp-up as 240 seconds for this scenario.
Let me describe you in details:
Ramp up is the time in which all the users arrive on your tested application server.
Requests are simulated by samplers but threads are the simulation of users.
Please note- The total number of requests are related to throughput, Whereas the number of active threads performing the same activity is related to concurrency.
From your requirements, I assume you want to measure the throughput which is related to the requests/second not the users per second. To achieve this, you can use a Constant Throughput Timer at your test plan level.
Constant Throughput timer allows you maintain throughput of your server (requests/sec). Here requests are samplers. Threads are users/clients which are requesting server using samplers.
You can achieve this by using both "Thread Group" or "Ultimate Thread Group".
As far as I know, it doesn't matter which type of Thread group you are using with Constant Throughput timer, at the end of the test in the results, you will get your desired Throughput which you mentioned in Constant Throughput Timer i.e. if you have mentioned 1200/min in Constant Throughput Timer with "Calculate Throughput based on" value as "All active threads" and there are 3 requests (samplers) in your thread group then JMeter will manage the requests in a way that it will generate only 6.6 requests/sec for each sampler i.e. 1200/min is divided among 3 requests, it doesn't matter whether you are using Ultimate Thread Group or the Thread Group; Throughput timer works in same way for all types of thread groups.
Now as per your requirement: (Using Thread Group):
No. of Threads : 1200
Ramp-up Time - 240 (Since you want 5 users per second, 1200/5= 240)
Loop count - Forever
Scheduler (Duration) - 780 Seconds [13 Minutes]
IMPORTANT:
Thread Group configurations will be the same which you have already mentioned. Number of threads will be the client load which you want to put(in you case it's 1200), duration : (240+300+240), loop : forever, ramp-up : 240 yes when you ramp up i.e. in the first minute generally you get more requests as threads are starting so it is normal behavior. To test your scenario run for exactly 5 minutes, you should test for 13 minutes. Exclude first 4 min and last 4 min of the test as that is warm up time for your test as well as server and last 4 min are warm down period.
Now as per your requirement: (Using Ultimate Thread Group):
Start Thread Count: 1200
Initial delay, sec: 0
Startup, sec: 240 (I assume you want 5 users come to your application for requesting expected samples per second)
Hold Load for: 300 sec (Since you required 5 minutes to test for 1200 users)
Shutdown Time, sec: 240
You can set just like this:
Don't get confuse the Thread number with the number of requests, each thread will create multiple requests for seconds in field Hold Load for.
Rampup is the speed at which users arrive on your application.
The number you put means that once it is reached all threads have been started.
The tiniest it is , the faster users arrive.
So nobody can answer that for you, you need to analyse your traffic.
Regarding the number of threads, 1200 threads might not be the good number, as 1200 users can navigate on application slowly or rapidly.
What you need is add a Constant Throughput Timer to control how much transactions per second you'll be reaching.
You should use the Ultimate Thread Group plugins available in Standard set.
To maintain concurrency the configuration should be like this:
Start Thread Count: 1200
Initial delay, sec: 0
Startup, sec: 60
Hold Load: 180
Shutdown Time, sec: 60
Ultimate Thread Group
Here all the 1200 threads will be generated and up within 60 sec of Startup time(Ramp up time) .Those 1200 threads will be active for next 180 sec, and after that, those threads will shut down within next 60 sec.
So overall duration of the test is 300 sec as you desire. Throughout the Hold Load time(180sec) the requests will be looped.
This ultimate thread group will give you more control over Threads.
Now if you want to control the rate of transactions per second or the number of samples to execute you can use Constant Throughput Timer. Constant Throughput Timer will let you control the flow of requests to be sent. The default "Thread Group" only control the way the users or threads will be generated.It doesn't control the rate of requests to be hit your application.So for this purpose, you could use "Constant Throughput Timer" to control your requests per second. For further detail, you could go through JMeter documentation.

Generate seasonal load pattern using jmeter

I'm trying to generate seasonal load pattern using jmeter but not able to simulate the situation.
For example, I would like to have threads with constant request per seconds (say, 60 requests per second) running always in the system. Another thread group is responsible for generating seasonal spikes, say each 10 minutes interval, it will generate 120 requests per second for, say, 5 minutes. So, each 10 minutes interval I will have spike which lasts for 5 minutes. Any scripts or suggestions to simulate this situation will be helpful.
As you are already aware, you would need 2 thread groups to achieve this requirement.
Thread Group 1:
You can use Constant Throughput Timer to maintain the throughput 60 requests / second.
This timer introduces variable pauses, calculated to keep the total
throughput (in terms of samples per minute) as close as possible to a
give figure. Of course the throughput will be lower if the server is
not capable of handling it, or if other timers or time-consuming test
elements prevent it.
Thread Group 2:
To create seasonal spike, Ultimate Thread Group might be a good choice or We can also use the regular thread group with Constant Timer to simulate 10 minutes interval & Startup Delay property of the thread Group to give initial delay if any.
To generate load only for 5 minutes, use Runtime Controller.
You would need another Constant Throughput Timer to maintain the throughput of 60 requests / second in this thread group.
Make your Thread Groups to run Forever or select desired duration using "Scheduler" option:
In 1st Thread Group add Constant Throughput Timer and configure it as follows:
Target Throughput: 3600 (60 requests per second * 60 seconds in minute)
Calculate Throughput based on: I believe the best value would be all active threads in current thread group
In 2nd Thread Group add Throughput Shaping Timer and configure it like:
You can use different ramp-up and ramp-down figures, the graph will change to represent your load pattern.
Remember that both timers don't kick off any extra threads so you will have to provide enough threads on Thread Group level in order to create and maintain desired load.

How generate maximum hits/s

I have recorder a simple flow using jmeter. I have multiple http requests under one thread group. I am trying to run this thread group for 50 concurrent users in blazemeter. But when ever i try to run the jmx file i can see that htis/s is around 3 sec. Though my rampup time is 0 & thread is 50. My understanding is if the users are concurrent & each user (thread) have 3 requests to make, then minimum hits/s should be 50.
I have added a constant throughput timer at the bottom of the thread group & a throughput controller. In the timer target throughput is set to 300 & in the throughput controller throughput is set to 100 with percent execution.
How do i achieve maximum hits/s in blazemeter? Or am i missing something here. Thanks in advance.
I think that you're misusing Constant Throughput Timer.
Throughput of 300 requests per minute gives 300/60 = 5 requests per second
Constant Throughput Timer works on minute level so make sure that your tests lasts longer than 1 minute
Each JMeter thread representing virtual user executes nested samplers upside down, when thread has nothing more to do it is being shut down. Make sure that you have enough job for threads and if not - make sure that you provide enough loops (see point 2 as well)
Constant Throughput Timer cannot kick off any new threads, it is capable of throttling (pausing) current active threads to limit load to throughput defined. So try increasing threads count.
For more information refer to How to use JMeter's Throughput Constant Timer guide
You may also like to use Throughput Shaping Timer instead, it provides a little bit more flexibility than JMeter's CTT.

Resources