Jmeter - Dummy Sampler vs Flow Action - jmeter

I have read the user guide, here or on Blazemeter blogs regarding usage of flow action to implement dynamic pacing in Jmeter script with help of a JSR223 timer. I wanted to check if I can use JMX dummy sampler to implement the same JSR223 timer?
Does it really impact performance if using Dummy Sampler vs Flow Action in performance test scripts as both are samplers only. Please advise and any support link would be appreciated.

Impact performance of what?
"Pacing" is yet another approach to control the number of hits per second by slowing down the requests for whatever reason (not to overwhelm the application, send desired number of requests per second, etc.)
Any implementation of "pacing" is "killer" of the performance because it adds a pause between iterations instead of starting new iteration immediately so your question doesn't make a lot of sense. If you want to use the most resource efficient solution - you need to either share your implementation details for these 3 approaches or better measure it yourself using a profiler tool
If you're looking for a easier/better way of sending requests at constant rate instead of implementing the "pacing" I would rather recommend considering using of the following test elements:
Constant Throughput Timer
Precise Throughput Timer
Throughput Shaping Timer

Related

Unable to achieve TPS while using throughput controller along with Unique Each occurance parameterization customization

I've to execute a test where one transaction can have multiple-lines (Eg: orders placed by different users in the real world where every user can have different cart size). In order to achieve this I have a products list and I need unique product at every occurrence. I have used a code similar to this "https://www.perfmatrix.com/jmeter-parameter-setting-unique-each-occurrence/" and I was able to achieve unique each occurrence. But the problem is when I am using a throughput controller and constant throughput timer I am not able to achieve desired TPS whereas hardcoded payload with various lines (with throughput controller and constant throughput timer) leads to desired TPS. Do we have any other options to achieve this?
Beanshell Sampler might be the root cause of the problem, according to JMeter documentation you should be using JSR223 Test Elements and Groovy language for scripting since JMeter 3.1 because using Beanshell is a some form of a performance anti-pattern, check out Apache Groovy: What Is Groovy Used For? article for more details.
Another possible reason could be test data itself, for example request A is "light" and returns data in less than one second due to its request parameters and request "B" is "heavy" and returns data in more than 5 seconds.
Throughput of 100 requests A and 100 requests B will be different so you might need to add more threads.

What timer to use to control the API requests?

I am trying to load test an API and I am trying to make sure I fire only 2 requests in a second due to the throttling limit set at the API Gateway level so if the third request is sent within a second (this happens if the response time of the earlier request is < 1 sec) then I get HTTP-429 error saying 'too many requests'. Please could someone suggest if I can use any timer to achieve this?
Thanks,
N
Constant Throughput Timer is the easiest of built-in test elements, 2 requests per second is 120 requests per minute. However it is precise enough only on "minute" level so you might need to play with ramp-up period
Precise Throughput Timer is more "precise" but a little bit harder to use as you need to provide controlled throughput and test duration
If you don't mind using JMeter Plugins there is Throughput Shaping Timer which provides the maximum flexibility and visual way of defining the load
For this particular case, I suggest the Arrivals Tread Group. This TG will let you exactly configure the desired TPS (Arrival Rate), plus the plugin will instantiate the necessary threads to generate the load. No need to guess how many threads/vusers you'll need.

Transaction Controller Usage in Jmeter

I know that transaction controller is uage to logically group multiple samplers and it generate a sampler of itself. However I have a question on script performance optimization.
How advisable it is to use Transaction Controller if I have only Sampler in it? Does it impact the memory badly if I have 10s of those in the a thread group. Any link to best practice regarding the same will be appreciated.
Each element has its cost. Transaction Controller's cost is relatively low, it's just generating a virtual SampleResult plus adding metrics from each and every child to this virtual sampleresult plus sending the signal to the Listeners (if any)
There is no sense of having a Transaction Controller with only one child Sampler because it's response time, throughput, etc. will be absolutely the same as for its only child.
I wouldn't say that the number of Transaction Controllers in the Test Plan matter, it's more about the number of Samplers which are under the Transaction Controller (a little bit higher memory consumption, a little bit lower throughput), however if you properly configure JMeter you won't see any visible impact.
The only way to see the side-effect of having Transaction Controllers in the Test Plan is running your test with and without them under profiler tool telemetry

JMeter Add Think Time to children feature

In JMeter when I right click Thread/Controller I have an option: Add Think Time to children feature , when I click on it I get after every Sampler Test Action Pause with Uniform Random Timer with Random Delay 100 and Constant Delay 1000.
I didn't find in documentation any reference to it and why/how it should be used.
Is it configurable and how? is there a special case for it or should it be used for loading best practice ?
Also you can add several times think times I'm not sure is it on purpose (add more delays after request)
EDIT
Configurable using jmeter.properties:
# Default implementation that create the Timer structure to add to Test Plan
# Implementation of interface org.apache.jmeter.gui.action.thinktime.ThinkTimeCreator
#think_time_creator.impl=org.apache.jmeter.thinktime.DefaultThinkTimeCreator
# Default Timer GUI class added to Test Plan by DefaultThinkTimeCreator
#think_time_creator.default_timer_implementation=org.apache.jmeter.timers.gui.UniformRandomTimerGui
# Default constant pause of Timer
#think_time_creator.default_constant_pause=1000
# Default range pause of Timer
#think_time_creator.default_range=100
When it comes to web applications load testing the idea is to represent a real user sitting in front of computer using a real browser as close as possible.
Well-behaved JMeter test needs to mimic this real user with all its stuff like:
headers
cookies
cache
embedded resources
AJAX requests
etc.
The purpose of using Timers in JMeter tests is simulating real users "think times". Users don't hammer application non-stop, they need some time to "think" between operations, fill forms, type comments, even clicking on a button or link takes some time. So if you are testing if your web application supports X users each JMeter thread must act like a real user so you need to add reasonable think times using Timers. There is no "best practice" or "known good values", it depends only on your web application specifics. See A Comprehensive Guide to Using JMeter Timers for more details.
This feature is made to simplify addition of Think Times, the way it adds them to plan lead to pause between every sampler while if you just add a Timer it will be scoped and thus be applied before all samplers in scope.
As it's a helper, it adds default Pause of 1 second that are configurable by tuning the properties you have mentioned and which are documented :-) :
http://jmeter.apache.org/usermanual/properties_reference.html#timer
You can adjust:
The type of Timers you want to create
The constant and variable pause range
You can even create your own class that would work differently.

Apache JMeter Load Simulation in Intervals

I'm currently using Apache JMeter to run load tests on the REST interfaces of my backend application. The test plan currently uses two thread groups and runs those in loops. Both thread groups are sending particular REST requests at a certain throughput using a constant throughput timer. The first thread group randomly picks one of several different REST requests, while the other uses one fixed REST request.
With this setup, I'm able to fire load to my application at a constant throughput. Now, I would like to simulate that over a day/night load profile, given that from e.g. 8:00 am to 5:00 pm the load is at a certain constant throughput, while in the rest of the time (the night), the load drops to a lower throughput or even stops entirely. Then at 8:00 am the next morning, it rises again.
Do you guys know if such a load profile can be simulated using Apache JMeter? Do you also know, which constructs could be used to setup something like that?
Thanks for any hint.
Regards
Timo
You can consider switching to Throughput Shaping Timer which seems to be exactly what you're looking for. See Special Property Processing chapter for the "load profiles" bit.
You can get Throughput Shaping Timer element via JMeter Plugins Manager

Resources