JMeter Thread group Ramp up time plus duration question - jmeter

Running JMeter version 5.4.1
I have the following setup for a JMeter thread group:
Number of Threads: 300
Ramp-up Period: 300 seconds
Loop count: infinite
Specify Thread Life time: Duration 600 seconds, startup delay: 0
Thread group is set to continue after a sample error.
So with the above setup, I'm expecting the test to spin up 1 thread per second, when it reaches 300(5min) seconds, it will have a full 300 threads running. Each thread should be running for 600 seconds(10min) before stopping. I'm expecting the total run time to be 900 seconds (Last thread starts at minute 5 + 10 min run time = 15min).
But the actual behavior is different and I can't figure out why.
Actual behavior:
--300 threads spin up after 300 seconds, 1 thread per second. Cool this is what I'm expecting.
--at 600 second mark, the first thread start to die. Cool so far so good
--at 12min which is 720 seconds, ALL threads have died off, and the test is complete... umm.. what happened here? I was expecting a full 300 seconds wind down time, not 120 seconds?
As a result, the full test finished at 720 seconds (12min), instead of the full 900 seconds (15min).
Can anyone explain to me what is going on here?

You have to configure your test duration accordingly.
In your case, the test finishes at 600 seconds. The last 120 seconds was the ramp-down time of those active threads. You can observe it through Active Threads Over Time Listener.
Your total test duration would be like warm-up period + hold load activity + warm-down period. i.e (300+600+300)= 1200 seconds or 20 mins.
300 threads will be active in 300 seconds, then all the 300 threads will hit requests to the server for 600 seconds, and then those 300 threads will be down in the next 300 seconds.
You can also use Ultimate Thread Group like this as well for a better understanding of your test, where the warm-down period is used as 120 seconds, so the total duration of the test is (5+10+2)=17 mins or 1020 seconds.

It isn't exact and specify duration of the test plus finishing iteartion
This denotes the total duration of the test. One disadvantage to run the test by specifying the duration value is that the test stops immediately when the test duration is completed; without completing the loop (iteration) due to which you could see some differences in transaction count.

You specified test duration of 600 seconds, why do you expect your test to last longer?
Once 600 seconds are passed JMeter will ask threads to stop and the time required for all of them to stop mainly depends on the nature of the test, request/response size, etc. In ideal conditions the test should be stopped immediately.
So if you want your test to run 15 minutes - set duration to 900 seconds.
If you want the gradual ramp-down - consider adding a Timer to your Test plan or switch to a custom thread group which allows precise control over threads, see How to Ramp Down in JMeter article for more details.
Coming back to threads termination taking 2 minutes, it should not be the case, make sure to run your JMeter test in command-line non-GUI mode and follow other JMeter Best Practices

Related

JMeter - How long should I set the ramp up period for 500 users over the space of 1 hour

I need to test an application can handle 500 users over the space on 1 hour. How long should I set the ramp up period for the specified amount of time and users?
It depends on what you're trying to achieve. There are no "strict" rules, no recommendations either.
As per 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.
So you can use 500 as ramp-up so all 500 users will be online in 500 seconds.
Other option is to set ramp-up period for 1st 30 minutes and next 30 minutes keep the load of 500 users.
The idea is to add users gradually so you could correlate increasing load with other metrics and KPIs like response time, number of transactions per second, number of errors, etc. so you could state where is the saturation point, where is the first bottleneck, etc.
More information: JMeter Ramp-Up Period: The Ultimate Guide
The ramp-up period, Is the time needed to start all the threads defined.
So, If you add 3600 with 500 Thread, This will mean a new thread will be launched every 7.2 seoconds, And the last one will start after 1h ( 3600 seconds)
If this is what you want, you can set Ramp up to 3600.
quote from official doc
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.

JMeter 14 Hour Soak Test

I need to run a 14 hour soak test in JMeter. Need to hit a few pages with around 100 users an hour - so nothing crazy.
What would be an appropriate way to set this up in terms of ramp up period etc?
"100 users an hour" doesn't make a lot of sense, if you need to mimic 100 users for 14 hours you need to configure Thread Group like:
with regards to ramp-up - as per 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.
the point is to increase the load gradually so you can ramp-up i.e. for first hour and then hold the load for remaining 13 hours if nothing bad happens during the ramp-up phase
Also make sure to configure JMeter to behave like a real browser when it comes to:
cookies
embedded resources (images, scripts, styles, fonts)
cache
think times

In Jmeter how to find the response time for 1k/2k concurrent user, and also what should be Ram-Up time for 1k and 2k user

I have a requirement like API should be capable of handle 5k Concurrent user in 5 Sec.
How can i test this scenario in jmeter.
For 1k Concurrent user what should the RampUp time to be set in Jmeter.
5000 for 5 seconds is quite easy to achieve:
With normal Thread Group
With Concurrency Thread Group
With regards to the ramp-up, I can only give you:
a quote from 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.
and a piece of advice on ramp-up in general: if you're doing some form of a stress test it's a good idea to increase the load gradually, this way you will be able to correlate increasing load with the throughput and response time because running 5000 threads for 5 seconds will give you only a basic information on the response time for this workload and you won't be able to tell what is the maximum number of users/requests per second the application can support, when performance starts degrading, etc. So you could consider a load pattern like this:
and look at Response Times Over Time chart to see the relationship between the number of concurrent users and the application response time

Find out if a server can handle 100 users in one minute using JMeter

I am testing an API endpoint. I would like to know if the server can handle 100 users in one minute.
This is the thread configuration that I am currently using.
My question is:
did I configure the threads, ramp-up period, and duration parameter correctly?
How much ramp up period is ideal, against the number of threads?
I would recommend either decreasing the ramp-up or increasing the test duration because with your current settings you will have 100 users online only during the last second of the test
So set "Duration" to 120 seconds so during first minute your threads would be ramping up followed by another minute of 100 online users or go for something like:
30 seconds of ramp-up
180 seconds of duration
You may find i.e. Ultimate Thread Group easier to use, it's default workload pattern seems to match your scenario:
and you will be able to play with ramp-up, ramp-down and time to hold the load and see the anticipated threads count in the chart.
You can install Ultimate Thread Group as a part of "Custom Thread Groups" bundle using JMeter Plugins Manager
The whole point of ramp-up is that your should be increasing the load gradually so you could correlate the increasing load with other metrics (throughout, response times, errors, etc.)
As per 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 add 10 threads every 1 minute?

I want to add 10 threads every 1 minute in my load testing.I put 300 seconds in my duration equivalent to 5 minutes. So the total threads are 50 after the test. Heres the config in the thread group. I am using JMeter GUI.
Threads: 10
Ramp up: 1
Duration: 300 seconds
Ramp up is the time in which all the users arrive on your tested application server.
In Thread Group 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).
Thread Group also provides a scheduler. Click the checkbox at the bottom of the Thread Group panel to enable/disable extra fields in which you can enter the duration of test, the startup delay, the start and end times of the run. You can configure Duration (seconds) and Startup Delay (seconds) to control the duration of each thread group and the after how much seconds it starts. When the test is started, JMeter will wait Startup Delay (seconds) before starting the Threads of the Thread Group and run for the configured Duration (seconds) time. Note those 2 options override the Start time and End time.
Set your Thread Group like this:
No. of Threads: 50
Ramp-up Time - 300sec (Since you want 10 users per min, 10*60*5= 300)
Loop count - Forever
Scheduler (Duration) - 900 Seconds [Total 15 Minutes: 5 mins for users ramping up time, 5 mins for your test and 5 mins ramping down time]
To know the details, you can also see this thread on How should I calculate Ramp-up time in Jmeter.

Resources