Test execution using N Threads and N2 Loops - jmeter

Jmeter executed the following test using only one thread Thread group 1: Thread Group
In this test there are the following Thread group properties: Thread Group properties
Loop controller configuration: Loop Controller
Accoring to this scenario, Http request GET CustomerDataUpdate should be executed simultaneously using N (50) threads, for each call taking new customer ID from a CSV file (CSV Data Set Config Customers) and Http requests POST StockUpdate and GET PricesUpdate should be executed in parallel in a loop for each Customer N2 (50) times, taking new product ID from a CSV file (CSV Data Set Config Products).
Why my test is executing all the steps only using Thread Group 1 (as shown below) ? Thread Names
I am expecting this test to be executed using N (50) Threads simultaneously for N unique Customers and N2 (50) unique Products for each Customer, getting Customer ID and product ID from a CSV files.

What your test does is:
50 threads and 50 loops in the Thread Group mean that CustomerDataUpdate will be executed 2500 times
After executing the CustomerDataUpdate each thread will execute StockUpdate and PricesUpdate 50 times each due to the Loop Controller
In total you will have:
CustomerDataUpdate - 2500 times
POST StockUpdate - 125000 times
GET PricesUpdate - 125000 times
Neither CustomerDataUpdate nor StockUpdate will not be concurrent as Parallel Controller is executing its children in parallel, are you looking for the Synchronizing Timer?

Related

How do i read the contents of a csv file specific number of times in JMeter?

I have a csv file that has 100 rows. How do i read this file 2 times (2 * 100) and then stop the flow? I used Loop controller and gave loop count 100 and the loop count in main thread group is 2. Its working good when iam running the test with 1 thread but when i update the number of threads to 10 then the total number of requests are 2000. How do i make my test run only 2 times (iterate my csv file only 2 times with number of threads = 10). Any help is appreciated.enter image description here
enter image description here
enter image description here
If you're using default CSV Data Set Config settings when it comes to "Sharing Mode" (each user will read next row on each iteration)
Remove your Loop Controller
Amend your Thread Group configuration to have 20 loops:
In this case you will have 200 total requests, each line from the CSV file will be hit twice:

Jmeter - How to perform data compare on two JDBC requests for the entire DB

I want to compare data between two databases, where there are 700K records to be compared, and that number is increasing all the time.
My architecture is:
Where based on the MAIN query i run:
JDBC1 & JDBC2 and, then i compare the data between JDBC1 & JDBC2.
If i put static limit in the main query,
select * from transaction_info
order by id asc
limit 1000
everything works fine, and i know how to compare the data.
But, how can i make all this dynamic, so i can break-down the main query like:
1. Query first 1000 rows, then compare/assert.
2. Query next 1000 rows then compare/assert.
And all this to continue till the 700K records?
Any help is appreciated!
As part of your main query SQL, you can include a combination of LIMIT and OFFSET to get incremental fetch of rows and variabilize the OFFSET part like below in order to bring in the dynamism
select * from my_table limit 1000 offset ${offset_value}
For the offset variable, define a Counter config element whose starting value is 1000, increments by 1000 until a max value of 700K. In case you want each user to do this process, then check on "Track counter independently for each user"
This way, everytime you will fetch 1000 rows then the subsequent 1000 in sequence
My suggestion for Test Plan
You can remove the loop controller and place the sub-queries along with assertion as siblings to the Main query and define the Thread Group's loop count to 700. This way the main query along with the sub-queries and assertion are triggered 700 times with each time fetching, processing and asserting 1000 rows at a time.
Sample Test Plan
Thread Group Loop Count Configuration
Hope this helps!

CSV Data Config not working correctly with my Thread-Loop

I'm new in Jmeter and have a problem with loading user data from csv file within a thread loop.
I created a little testsuite.
threadgroup (Number of threads: 1, loop count 2)
load user data with csv data config
csv looks like this:
user1; password
user2; password
....
simple http request
If I run my test I will get this output:
- http request for user1
- http request for user2
I would have expected that only for user1 the request would be executed twice.
What am I doing wrong?
Regards,
Michael
If you want to achieve the described behavior you need to:
Amend your Thread Group to have 2 threads and 1 loop
Amend Sharing Mode of your CSV Data Set Config to be Current Thread or ${__threadNum}
Demo:
what do I have to do if I want to execute a request for several users? With this example I can only execute requests for the first user in my CSV file. But my csv file has several users
I will do the following test:
for every user in my csv file do a http request (as often as specified by loop count in my thread group)
Example:
CSV has 10 users
Loop Count 5
Do for every of the 10 users the http request 5 times

Is it possible for a thread to select its own unique data from the csv file?

Is it possible for each thread select its own unique value from the csv file, say user1 has account number 202 and the next time it comes in the loop will thread user1 select 202? If not is there any other way out?
I created a thread group and included a http request sampler(login) to read credential.csv to login each user and then another http request sampler to read from accounts.csv to process each unique user specific account. But now since I made the thread run continuously for 5 mins the account numbers got mixed up? Can anyone suggest a way out....
If an account number must sync up with a specific credential, you should put them in the same CSV file. Thus, thread1 gets row1 data, thread3 gets rows3 data, etc.
Also, to clarify, a thread only exists for a single loop. Once you loop through your testplan, thread1 ends and becomes thread X
In your CSV Data set config select sharing mode to current thread instead of all thread.
If you want each thread to have its own set of values, then you will need to create a set of files, one for each thread.
For example test1.csv, test2.csv, ..., testn.csv.
Use the filename test${__threadNum}.csv and set the "Sharing mode" to "Current thread".

How to synchronize JMeter Thread groups

I fill the database with JMeter. There is 2 thread groups which fill 2 tables in parallel.
After these 2 tables filled I need to start the last thread group to fill the third table.
How can I do it?
Is it possible to synchronize JMeter Thread groups?
You could do a while controller for the third thread group, and do something like this:
ThreadGroup 1
- Code to fill Table 1
- Set a UserDefined Variable "Group1_done==true" as the last step
ThreadGroup 2
- Code to fill Table 2
- Set a UserDefined Variable "Group2_done==true" as the last step
ThreadGroup 3
- WHILE CONTROLLER "Group1_done==true"&&"Group2_done==true"
- Code to fill Table 3

Resources