Jmeter for QPS test seems not precise? - java

From the 'Thread Properties' configuration, I think the QPS is 750/50=15. But when I run the test , the elapsed time is '00:01:01'. Does it means the real QPS is 750/61=12 ?

JMeter acts as follows:
Given your setup JMeter starts with 1 virtual user and adds 15 users each second
Each virtual user starts executing samplers upside down (or according to the Logic Controllers) as fast as it can
When there are no more samplers to execute or loops to iterate the thread is being shut down
When there are no more threads left the test finishes.
QPS depends on many factors, the main are:
Number of samplers in your Test Plan
Sample Result response time
So QPS is not something you can efficiently or precisely control, the options are in:
If QPS is too low
Add more "Loops" to your Thread Group so threads could re-execute samplers maintaining 750 users concurrency as looking into your Test Plan and execution time it appears you have around 13 simultaneous users only
Add more virtual users
If QPS is too high you can slow down JMeter threads to desired value using Constant Throughput Timer

50 seconds is the ramp up period, which means thread number 750 will be executed after 50 seconds, the elapsed time is influenced by the ramp up period but it only effect the starting time of the test.
Notice Test can be executed even "forever" by checking Forever in loop count
In your case Loop count is 1 , but test can be last for hours if there's a long list of slow HTTP requests or complex loop controller or other Test Fragments inside test.

Related

How to loop Samplers with different intervals in same loop using JMeter

Idea is to loop requests independently, the thread will run for 20 minutes. One Sample will sample every 5 seconds. Other Samples in Simple controller will loop one by one with 10 second delay.
I don't think you will be able to run Samplers with different throughput within the bounds of one Thread Group because JMeter will always wait for the previous Sampler to complete before starting the next one.
The options are in:
Either move /api-common/rest/rmslistterms to a separate Thread Group
Or add the If Controller as a parent for the /api-common/rest/rmslistterms and configure it to run every 2nd iteration, example __jexl3() function you can use would be something like:
${__jexl3(${__jm__Loop Controller__idx} % 2 == 0,)}

JMeter TearDown Issue

Hi everyone in my Test i have this lineup:
jmeter set up
In the thread group the duration is set to 300 sec.
My goal is to make the first 3 requests in a time X sec (about 10), make those in the loop count for Y sec (180 sec, with loop count equal to 1000) and the last two for Z sec (about 10).
another question is: if the lifetime thread ends before the whole loop controller is executed, I want the last two requests to act as teardowns. How can I set them?
Can anyone give me some advice on how to act?
My goal is to make the first 3 requests in a time X sec (about 10)
and
last two for Z sec (about 10).
this is achievable by Timers or Flow Control Action sampler
make those in the loop count for Y sec (180 sec, with loop count equal to 1000)
Put "those" under the Loop Controller, mention the start time via __time() function and put an If Controller somewhere inside the Loop Controller to compare current time with the start time, if it exceeds 180 seconds - use the aforementioned Flow Control Action sampler to exit the loop
With regards to your "another question" I think you should rather start a new thread, it's quite hard to answer several "another" questions and it makes the process of searching for the answer for other people harder.
Whatever.
Currently I would recommend to use:
setUp Thread Group for preparing the test data or the system for the load test
tearDown Thread Group for cleaning up
eventually you can use __setProperty() and __P() functions combination or Inter-Thread Communication Plugin to pass the data between thread groups
If you need to implement the tearDown within the bounds of a single Thread Group - either go for the above approach with Loop Controller + If Controller + __time() function or go for Runtime Controller

Jmeter multiple concurrent users in single thread group

I have 1 thread group and I have defined 100 threads and 1 Iteration with a single HttpSampler. Basically I am testing a single GET API.
Now, Jmeter should start 100 threads and then they should fire request to my server which have the API. The server can respond to 100 requests concurrently. So, basically at any point in time I should have 100 concurrency.
But that is not what is happening when I checked through Blazemeter. I get a max users of 37 and total users as 100 which means max concurrency during the test was 37.
This can be possible only if Jmeter did not executed the threads parallel. So where am I wrong ?
I want all threads to execute parallel after they all are created and fire requests at once so that maximum concurrency is 100 for 1 iteration.
If you need more control and accuracy use Ultimate Thread Group JMeter plugin (instead of regular Thread Group)
Set Start Thread Count as 100, with 0 initial delay and 0 Startup Time, with positive Hold time, your thread will hold 100 max users
General example:
If your computer can't handle generating load, you may need distributed testing setup
It is not suggested to use Ramp-Up period as 0.
I think you are making confusion between concurrency (Related to virtual users) and simultaneous (Related to requests or samplers).
To hit requests simultaneously, use the Synchronizing Timer as a child of your requests. It will pause X number of threads and then released at once. And before that, to maintain the concurrency at 100 users, try to use the ramp-up time accordingly (i.e 10 seconds). So it will take 10 seconds for 100 users alive on the server and then hit the requests for 100 users simultaneously.
It doesn't matter which thread group you use but if you maintain the concurrency for more period of time (hold that concurrency), then use Ultimate Thread Group or you can use the loop count accordingly.
If you want to perform spike testing, then the regular Thread group is fine. But you have to remember that, some of your threads might already finish their work and were shut down so you won't see the expected number of the concurrent user.
Here are the example screenshots for 1 minute Test duration (100 users ramp-up time 30 sec + hold load time 20 sec + 10 sec for ramp downtime)
Ultimate Thread Group Config:
Test Results (100 requests at once):
Test Results (100 Concurrent users):
Hope it helps you to understand.
To achieve this, you can use Synchronizing_Timer. Add Synchronization Timer as a child of your GET Request.
The purpose of the SyncTimer is to block threads until X number of
threads have been blocked, and then they are all released at once. A
SyncTimer can thus create large instant loads at various points of the
test plan.
Secondly, to keep a constant load of 100 Request Per Second/Hit Per Second for a time duration, you can use Throughput Shaping Timer. Make sure, you add the Loop Count to Forever and Duration accordingly in Thread Group.
JMeter acts as follows:
The number of threads specified in the Thread Group is being kicked off during the ramp-up period
Each thread starts executing Samplers upside down (or according to the Logic Controllers)
When thread doesn't have any more Samplers to execute or loops to iterate it's being shut down
Assuming all above you may run into the situation when some threads have already finished their work and were shut down and some haven't yet been started. Check out JMeter Test Results: Why the Actual Users Number is Lower than Expected article for more comprehensive explanation if needed
Therefore the solutions are in:
Provide more "iterations" on Thread Group level to let your users loop over, this way you will have 100 concurrent users
If you need to perform some form of Spike Testing and don't want/cannot increase the number of loops just use Synchronizing Timer, this way JMeter will pause the threads until the desired amount is reached and release them at exactly the same moment

JMeter - force all transactions/threads to stop when test reaches duration

I have a custom controller type which runs it's own specific test fragments. The important thing to note is that these fragments contain Transaction Controllers, which contain gaussian timers simulating wait times of up to 5 minutes.
The tests I am running are data driven, and should be runnable for a varying length of time. To specify the runtime of a test I have been using the "Duration" option on the Thread Group scheduler.
In the event were a test has ran beyond its duration, I've noticed that when these timer fragments are in use, the test is delayed and cannot end until the transaction (or at least the timer) has been complete. The other timings and samplers recorded seem to be unaffected, however the runtime of the test is impacted.
I'd like to solve this issue without having to rely on the user manually killing a test when it has reached it's duration. Is there any option within JMeter to kill or interrupt any type of running thread when a duration has been reached?
As per my understanding with Jmeter, there is no element which can stop the running test on reaching specific duration.
However, an element named 'Test Action' can be used to Pause/Stop/Stop Now actions on your test during run time and this element can be used under 'If Controller' element so that you can set the condition in this element to stop the thread.
Although JMeter provides various head-on elements to handle different conditions but in rare cases where existing elements could not provide direct solution to the problem then JMeter experts in any software testing company uses multiple elements with child-parent hierarchy to handle the condition [as used above with Test Action & If Controller elements]
I believe this has to do with stop test vs shutdown. When a test reaches its duration, it will issue a stop test, at which point any timer will finish, the request will happen, then the thread stops. This is why manually shutting it down works- shutdown doesn't respect timers, etc.
I don't think there's a way to set duration to use shutdown rather than stop. One thing you might try is multiple, smaller timers, and see if it still waits for all of them.

Quartz Jobs overlapping

I have a few quartz (2.2) Jobs running. Let's say one is running ever 5 seconds, another on runs every 10 mins.
I don't want 2 jobs to be executed the same time. I've seen this
DisallowConcurrentExecution
but this only applies to jobs from the same instance but I generally don't want two jobs (of any instance) to overlap.
Edit:
All the jobs working with one database, so this is why it's important that they don't run the same time. Each job has different things to do.
The simplest way is to configure the underlying thread pool to use one thread, this will achieve your goal. Add the following property to your quartz.properties configuration file:
org.quartz.threadPool.threadCount
The number of threads available for
concurrent execution of jobs. You can specify any positive integer,
although only numbers between 1 and 100 are practical. If you only
have a few jobs that fire a few times a day, then one thread is
plenty. If you have tens of thousands of jobs, with many firing every
minute, then you want a thread count more like 50 or 100 (this highly
depends on the nature of the work that your jobs perform, and your
systems resources).

Categories

Resources