I am having 2 parallel controllers in my thread group, in both parallel controllers I have added 1 simple controller in which there are 10 API requests. When I execute the script with 2 threads and 2 sec ramp up time to check the start time of the thread groups then I observe that script completes 1 thread's parallel controller first then 2nd thread's parallel controller.
Scenario - To scan the barcodes from csv file.
Expected Result: Expected_Result_table_ss
and in the meanwhile when Parallel 2 is processing the barcode, the first controller should also pick the next barcode to scan. For ex when the 2nd parallel controller is scanning 110121 at 12:00:01:190 at the same second or after some milliseconds parallel controller 1 should pick next barcode 110123 to scan.
Actual Result: ActualResult_TABLE_ss
Jmeter Script Flow : Jmeter_Script_Flow_ss
I may be wrong but I think this execution will be more precise if I am able to execute these parallel controllers simultaneously. Please let me know if any other logic can be applied for the same to scan the barcodes simultaneously using script
Parallel Controller executes its direct children in parallel, your "Jmeter Script Flow" means sequential execution of all "API requests" by each thread (virtual user)
I don't think you understand the concept and use case for the Parallel Controller, it was implemented as a JMeter Plugin to overcome JMeter limitation of not being possible to kick off extra threads within the bounds of one virtual user making simulating AJAX calls quite hard. If scanning the barcode really produces 10 requests at exactly the same moment then your setup is good and you just need to move the "API requests" out of the "Simple Controller" so they would be direct children of the
JMeter threads are absolutely independent and know nothing about each other unless you use Inter-Thread Communication Plugin so each virtual user will be executing Samplers upside down as fast as it can
If you want to execute both scenarios at the same time with 2 users - take a look at Synchronizing Timer
Related
When I execute my jmeter script with below mentioned scenario then I get java.lang.RuntimeException in the logs and 2nd iteration/loop count APIs are not executed.
As you can see only for 1 thread APIs are visible in view result tree.
In this you can see that no APIs are executed for 2nd thread.
Runtime exception is coming.
Thread Properties
Number of threads : 1
Ramp-up period : 1
Loop Count : 2
Thread Group Used : Normal Thread Group
Controller Used : Parallel
Data is parameterized using 1 csv file only.
I also used "Transaction Controller" to verify but in that I didn't faced any issues and the threads were executing for the mentioned loop count. Is it normal in case of parallel controllers?
As per "Limitations" chapter of the Parallel Controller documentation
Parallel Controller does not support work with Transaction Controller so if used you can get an unexpected results. If you decide to use these controllers together familiarize yourself with already known problems that described in roadmap
So my expectation is that you need to remove either Transaction or Parallel controller from your test plan.
Parallel Controller is for "exotic" scenarios like handling AJAX requests when a single JMeter's thread (virtual user) kicks off one or more sub-threads
If in the reality your "Scan_API" requests are sequential - you need to remove the Transaction Controller and implement concurrency on Thread Group level
If in the reality all the "Scan_API" requests are executed at the same moment, i.e. when one user "scans" something 13 concurrent requests are fired - then you need to remove the Transaction Controller because you don't really need it, the total execution time of the "scan" would be the time of the longest request so Parallel Controller in "parent sampler" mode will return you the slowest request execution time and that would be the value you're looking for.
More information: How to Use the Parallel Controller in JMeter
I need write the following scenario in JMeter
Login via http request and in parallel sending calls for 8 hours.
After that running in parallel Login and Logoff and sending calls again for 8 hours
After that running in parallel Login and Logoff and sending calls again for 8 hours
After that running in parallel Login and Logoff and sending calls again for 8 hours
and after N runs … start everything from beginning.
I created N thread groups , and added parallel controller , and under the parallel controller i added the loop controller of Login , Logout, sending calls
it didn't worked , the test stops after running the first run of thread group, it doesn't run as duration time .
what i m doing wrong , maybe i have to write the test plan different?
We cannot say anything meaningful without seeing your Thread Group configuration, for now I can only state that your test will end when:
the last user finishes the last iteration specified in the Loop Count
the test duration exceeds the "Duration"
whatever comes the first.
So make sure to tick "Infinite" box and specify the desired duration of your test plan
Also be aware that according to the How to Use the Parallel Controller in JMeter the Parallel Controller runs its children in parallel. Once. The main use case for the parallel controller is simulating AJAX requests to bypass JMeter's limitation of "one virtual user = one thread", maybe for your test scenario it makes sense to increase the number of threads in the Thread Group instead of going for Parallel Controller.
And last but not the least, be aware of the Runtime Controller which executes its children for the specified duration.
I have a single thread group which has 3 requests and have set the Number of Threads(users) = 2.
I would like all the requests to be executed in sequential order for each user before it repeats these steps for the next user and so on.
Output expected:
HTTP Request 1_Thread 1
HTTP Request 2_Thread 1
HTTP Request 3_Thread 1
HTTP Request 1_Thread 2
HTTP Request 2_Thread 2
HTTP Request 3_Thread 2
However, the output results vary differently for each run and are not in the order I expect. How can this be corrected?
I have tried following but with no luck in achieving my output
1. Enable/disable "Run Thread Groups consecutively
2. Running the test in non-GUI mode
I have attached a screenshot as an image as I am not able to embed into this message yet.
Appreciate if anyone can help me with this query
Thanks
Output Screenshot
For execution of Sampler Request by only Single Thread at a time use Critical Section Controller.
For more info about Critical Section Controller Critical Section Controller
The Critical Section Controller ensures that its children elements (samplers/controllers, etc.) will be executed by only one thread as a named lock will be taken before executing children of controller.
Critical Section Controller takes locks only within one JVM, so if using Distributed testing ensure your use case does not rely on all threads of all JVMs blocking.
Practical Example:
Place all your request under Critical Section Controller
Run the test for any number of Threads you want
Observe the Result in View Results Tree
Note : If you want to run it sequentially from 1 thread to N, make sure you provide Ramp Up Period properly.
I have created seven thread groups which execute different scenarios in one application. I'm trying to optimize my scripts in order to be more maintainable and easy to master when someone else uses them.
The thing that i cannot figure out is how can i combine those thread groups into one or two and to still have the seven different execution paths and the possibility to control them, by control i mean to set how many users to execute scenario 1, how many to execute scenario 2 etc. till 7.
Currently the test plan looks like this
If you don't want several thread groups for some reason the alternative options are in:
Throughput Controller - with different global executions or execution percentages
Switch Controller - which provides random weighted values (in some cases Throughput Controller doesn't guarantee that samplers in scope will ever be executed)
See Running JMeter Samplers with Defined Percentage Probability guide for more information on configuration and implementation.
Well i just figured out how to do that i have added a Loop controller a Random Order Controller as child of the loop controller. And i have put seven throughput controllers as child of the Random Order Controller so now everything looks fine
I am trying to run http samplers sequentially for multiple requests. Where the output of 1 API response is the input of next API request. My concern is when I run with 5 users (for. e.g), then at given point of time it first executes 1st API with 5 users then second API with 5 users, in this process the API where input is required gets lost. Please help me on this. I need a solution, where all the samplers are first executed for first user, then for second thread all the samplers are executed and so on.
Dzizu is correct, threads are independent so you are going to run into problems with this approach.
Since you are using 5 users across the test, it would be better to have one thread group with 5 users, and then have Simple controllers (or Transaction controllers) that hold the HTTP samplers and whatever else you are using. This will ensure that the samplers are executed concurrently, but they can still share data if required.
Simple example below:
Threads usually are independent. The easiest way in my opinion is to put full process in one thread and then multiply threads in thread groups.
Eventually I tried to solve this by using loop count option. For example if I want to simulate 5 users in 1 second, I set values as loop count=5,threads=1,ramp-up=.2.
This worked for me so give it a try.
Use the Transaction Controller or Simple Controller to group your samplers together and run them in sequence without worrying about the number of threads. For me, it is working as expected :).