Run sample randomly in JMeter - jmeter

I have three request in the plan, the third one in an put request.
If I have 30 virtual users, for instance, how can I run the third request (put) just few number of time in a random way?
Sample 1
Sample 2
Sample 3 ( put)
If I used 30 VU, I need the output be like:
Sample one - 30 hits
Sample 2 - 30 hits
Sample 3 - 5 hits ( random number), distributed over the test, 2 at the beginning, 1 at the middle and 2 at the end of the test - this is an example.

Put third sampler under Throughput Controller with Percent executions with percentage defined in Throughput field
Percent executions
causes the controller to execute a certain percentage of the iterations through the test plan.

The options are in:
Throughput Controller - if you want to try to run a Sampler more or less frequently than the others
Switch Controller - the same as 1 but if you need guarantee that the sampler will be executed at least once (you will need to come up with a proper "Switch Value"
Weighted Switch Controller - the same as 2 but it's easier to configure and use

Related

How to provide jmeter thread group , Ramp up peridod and Loop count?

I'm new to jmeter I have the following scenario. I want the jmeter to hit the given url, I have 13 such url in a csv file.
I want to hit the url at the rate of 2 requests per second for a given time period of 60 seconds.
In this case how should I specify my thread group, Ramp-up period and Loop count.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user. But I'm not sure how to specify when we have 13 such urls.
Atleast any link for the given scenario is appreciated.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user
not necessarily, JMeter waits for response from the previous Sampler prior to executing the next one, the configuration means that JMeter will start 1 user each second, it doesn't guarantee 1 request per second.
The easiest way of achieving X requests per second throughput is using Throughput Shaping Timer
Make sure to supply the sufficient number of Threads, i.e. if your application response time is 1000ms - 2 threads should be enough, if it's 2000 ms - you will need at least 2 threads, etc.
There is a special thread group: Concurrency Thread Group which can be connected to the Throughput Shaping Timer via Feedback Function so it will automatically kick off extra virtual users if the current amount will not be enough in order to conduct the required load.

How to test 7 customer transaction per second?

I am using jmeter for my performance test. The website needs to perform 7 customer transaction per second with the average TPS of 22.19 and maximum TPS of 25.01. So I have defined my test plan with 7 threads to run with 3 loops and asserted the response with 200 and 204. I also asserted the response with duration response for 2 second since it is needed.
but I am pretty confused how to assert this average TPS and maximum TPS ?. I am also not sure how to test 7 customer transaction per second. ? Thanks for you help.
Put all requests which belong to a customer transaction under the Transaction Controller and rename it to customer-transaction
Download and install Taurus tool
Create Taurus YAML config file for running your JMeter test looking like:
execution:
- scenario: simple
scenarios:
simple:
script: test.jmx
reporting:
- module: passfail
criteria:
- hits for customer-transaction>7 for 1s, stop as failed
That's it, if you will be receiving less than 7 hits per second the test will be automatically stopped as failed and have non-zero exit status code

Jmeter - Variation in count of different http requests within same thread group

Requirement: Load for a total of 100 users within an hour. Each user hits 3 different services different number of times at the same time.
for example: user 1 is going to hit service1- 3 times, service2- 5 times and service3 - 4 times at the same time. Same will be repeated for 100 users over 1 hour.
I have a thread with users-100, rampup time -60 (min). and then I am using parallel plugin and within that plugin created those 3 different sample requests. But I don't know how to configure the number of times, each of those service will be called per user at the same time.
Your test scenario doesn't make sense, normally 1 thread (virtual user) can hit only one endpoint at a time. The use when user executes 3 same requests to the same endpoint looks very suspicious as well. So I would recommend reconsidering your scenario and implement distribution using one of the following approaches:
Use different Thread Groups for different requests
Use Throughput Controller
Use Switch Controller
Use Weighted Switch Controller
If however I'm wrong and you're trying to implement some form of AJAX testing when requests are being triggered at the same time and in parallel - example test plan would be something like:

How to calculate load profile and choose thread group in Jmeter

I have a task to create profile load on the app. Profile load: Vuser 7 , 50 requests per hour. Create load dinamics: ramp-up 2 min , loading 20 min , end of loading 2 min. How to calculate this and choose thread group(and timer)?
Your test looks rather weird as 50 requests/hour is less than 1 request per minute and it is unclear why do you need 7 users and ramp-up/ramp-down periods.
No matter.
The easiest way of implementing your "load pattern" is using Ultimate Thread Group. It is not a part of normal JMeter distribution, you need to install it using JMeter Plugins Manager. The relevant configuration would be something like:
The easiest way of slowing down the requests to 50 request per hour is using Precise Throughput Timer, the appropriate configuration for your scenario would be:
You can check the actual throughput and the number of executed samplers using i.e. Aggregate Report listener. Given your test scenario lasts 24 minutes you should have around 20 sample results.

JMeter: Seeing a sawtooth graph instead of a smooth one (constant load)

I am using JMeter to load test my application. This is how my thread group configuration looks like:
I am expecting to hit the application with 200 threads (requests) and keep up that load for 30 minutes.
I am using 5 throughput controllers which use percentage executions and each HTTP request (under each controller) uses a specific percentage (totals to a 100).
I use the non-GUI mode to start the test and output the results to a csv. When I plot this though (using Kibana), I see a graph which looks like this
I see a peak and drop every 5 minutes. I am expecting to see uniform load across the 30 minutes I am running my test. Any idea why this is happening ? Is there something wrong with my configuration ?
Looking into "Loop Count" of 1 in your Thread Group I don't think your tests lasts 30 minutes, my expectation is that it takes seconds (or whatever time is needed to execute all your Samplers with 200 threads)
So tick Forever box or set "Loop Count" to -1 and re-run your test.
More information: JMeter Test Results: Why the Actual Users Number is Lower than Expected

Resources