The correct use of timers in a thread group (Until now my timers get ignored) - performance

My goal is to simulate 500 users that perform certain requests on the website in an amount of time of five minutes.
To make the test come as as close as possible to reality, I want to add a thinking time between requests (here: two seconds). The problem is no matter what I do, the timers get ignored. To give you an example, I would like to perform an login request every 2 seconds. Here is data of the thread group:
Number of Threads: 500
Ramp-Up Period: 300
Loop Count: 1
So what I did do till now to achieve this:
I used the constant timer and put it at as a child to my request, that didnt work, timer gets just ignored, no matter what value I use.
I tried the constant throughput timer, but that didnt work too, values get ignored.
What am I doing wrong. I added a screenshot so you are able to see where I did put the constant timer in my test plan.
Screenshots of my testplan:

In your case you can work without timers, you can use the Ramp up period to be Number of threads * 2 (seconds) to start Thread every 2 seconds approximately.
So in your case just put Ramp-Up Period: 1000 (and remove timer)

You are using wrong timer, Constant Timer just adds delay of 5 seconds before each request. If you want JMeter to perform login each 2 seconds you should consider switching to Constant Throughput Timer
Remember that Constant Throughput Timer acts precisely enough on minute level only so you might need to play with ramp-up period on Thread Group level in order to limit threads execution rate during first 60 seconds. Alternatively you can consider using Throughput Shaping Timer plugin

Related

How to make requests not match in load testing?

First of all I apologize for my bad English, I'll try to be clear.
I tried to run a Test in jmeter with 60 threads with 600 seconds for Ramp-up during for example: 15 minutes. The problem is that as I understand jmeter should distribute the load in at most 1 hits per second, which is not happening.
I'm using a Constant Throughput Timer with "Calculate Throughput based on (this thread only)" on 1 sample per minute. When the minute passes, the requests begin to coincide up to 10 hits per second.
I understand that this happens because the first thread executes a request and when the minute passes another thread executes a request and so on until the ramp up time is over.
The question is: is there any way to limit the hits per second, achieving, for example, in a test of 180 requests per minute, the hits per second reach a maximum of 3? exactly distributing the load evenly?
I hope I was clear
Thanks!
Yes, but you're using:
Not very accurate timer
The timer is not properly configured, it limits the number of request per minute for 1 thread and not considering other threads. Due to concurrency you can have > than one hit per second, you need to switch to all active threads (shared)
It will be much easier to use either Throughput Shaping Timer or Precise Throughput Timer, they are more accurate and self-explanatory.

How do I achieve a certain TPS in Jmeter

I am given a task in which I have to test my app for an hour with 300 TPS.
I have added my HTTP req in Jmeter and I need to configure below parameters to achieve my target
target concurrency
Ramp up time
Ramp-up steps
Hold target
thread iteration limit
I could guess by name few of these but still I am not quiet sure how to work around it to achieve my target. I am new to Jmeter can any one please help.
I assume you're talking about Concurrency Thread Group so answers are:
target concurrency - we don't know, it depends on your application response time, i.e. if response time is 1 second - go for 300, if response time is 2 seconds - go for 600, etc. If you don't know the response time you can put "sufficient" number of concurrent threads, for example 1000 and use Throughput Shaping Timer for limiting the load to 300 TPS
Ramp up time - again, we don't know your requirements. I can only recommend increasing the load gradually so you could correlate increasing load with increasing response time or number of errors so for example start with 1 TPS and increase the load to 300 TPS in i.e. 15 minutes and leave it running for 1 hour
Ramp-up steps - again, we don't know your requirements, start with above recommendation and adjust ramp-up period up or down as needed
Hold target - at least 60 minutes or 3600 seconds plus any ramp-up time
thread iteration limit - leave blank otherwise your test may end earlier than you expect
Example Concurrency Thread Group combination:
the values given in Schedule Feedback Function are for reference only, the example means that the Concurrency Thread Group will start 1000 threads initially with maximum of 1500 threads and have 300 spare threads in pool, hopefully it will be sufficient to produce 300 TPS load which is set by the Throughput Shaping Timer

Constant Throughput Timer seems to only gauge for 1 min

I am trying to run a post request in Jmeter. I want 10 requests to fire per second over a period of 1 hour. How could I achieve this?
Looking around, Constant Throughput Timer seems to be the popular option.
But for some reason, no matter what I switch around, I end up with only 500 requests. Can I please get some guidance as to why? It feels like such a basic option yet I simply can't figure it out. Been at it for hours and just not going anywhere.
My settings (For testing just trying with 2 mins, so I expect to end up with 1200 requests).
Thread Group:
Number of threads: 20
Ramp Up Period: 1
Scheduler checked.
Duration Set for 120 seconds (2 mins).
I then go on to add the Constant Throughput Timer. I set the value to 600 (Thus 10 requests per second).
As mentioned above, running this gives me 500 requests... I was expecting 1200 requests.. Why? Even if I extent mu duration to 3 mins, it would still be 500. Please help.
Constant Throughput Timer can only pause the threads to the desired throughput so if you want to achieve 10 requests per second with 20 users your application must be at most 500ms, if it will be higher - the number of requests per unit of time will be proportionally less.
So first of all try increasing the number of threads
Make sure to follow JMeter Best Practices (just in case JMeter is not capable of sending requests fast enough)
You may find Concurrency Thread Group and Throughput Shaping Timer more convenient and precise, moreover this combination can kick off extra threads if current amount is not enough in order to reach/maintain the defined throughput

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 to use the Constant Throughput Timer to specify a maximum of 4 concurrents users per second, during an hour

I need to create a load test in which there's a maximum of 4 concurrent users per second. Then I need to repeat this for an hour.
Is there any way to achieve this in JMeter?
I have tried using this configuration:
Number of Threads: 4
Ramp-up period: 1
Loop count: Forever
Duration:3600
And to make sure that this run exactly for an hour I have also used a Runtime Controller with the same "3600" runtime value.
But these creates more concurrent users per second than what I need and besides it's also unlikely to have that many concurrent users as user usually take so time to think before they do something and this wasn't reflected in my configuration so also tried using Constant Throughput timer , but this only confused me more.
I'm sure I need to use the Constant Throughput Timer, but I don't have the faintest idea of how to do it in my case.
If a use the Constant Throughput Timer, how should I configure the Thread Properties (Number of threads, ramp-up period,loop count, schedule) ?
Do I really need to use a Runtime Controller, to ensure that the test plan runs exactly for an hour or is enough to specify a duration value of 3600?
Constant throughput timer allows you maintain throughput of your sever. (req/sec)
here requests are samplers. Threads are users/clients which are requesting server using samplers.
I hope this have cleared distinction between request and user i.e. sampler and thread.
Now Constant Throughput Timer works on sampler per minute basis. so for your requirement of 4 req per sec. it becomes 240 requests per minute.
and you want to maintain this throughput among all threads (if you have multiple thread groups) or among a single thread group if you have single thread group.
So JMeter engine will start all threads with given ramp-up but will allow only 4 samplers to executes at a given seconds i.e. only 4 request per second.
Thus throughput is achieved among all threads and you can continue this for a specified time using either ways,
Test duration
Runtime controller
I hope it cleared your confusion and solved the issue.

Resources