I need to test throughput running 8 JDBC requests by 4 threads.
For example, let's say I have 8 jdbc queries q1, q2... q8
If I specify 1 thread total, queries would be run one by one in that order q1,q2,q3..q8 and I get total time to run all 8 queries.
If I specify 4 threads, I need all 8 queries executed only 1 time but spread work across threads:
q1 thread 1
q2 thread 2
q3 thread 3
q4 thread 4
q5 thread 1 (or any thread who would be done processing its first query really)
q6 thread 2 (or any other)
q7
q8
all done
I tried interleave with loop controller but I get either half of them executed, or 8 queries executed multiple times.
Basically, I need to measure throughput depending on the number of threads - how fast I can complete all 8 queries with 2,4,8 number of threads.
Hope it makes sense
The easiest option is putting your queries into a CSV file and using CSV Data Set Config to parameterize the JDBC Request sampler:
Once done you should be able to define as many threads as you want under Thread Group
So all the threads which you define will take the next value from the CSV file and run the respective query:
Related
Recently start learning Jmeter. I noticed that when I set thread group as:
threads: 2,
ramp-up: 10 seconds,
loops: 5.
Part1: it takes 1~5 sec to run the first thread, part2: 6-10sec to run 2nd thread.
And during part1, it loops and sends 5 requests, part2 the same.
My question one is: during each loop, are the 5 requests being sent one after another, and will only start after the previous one is fully finished?
In above example there are plenty of time for each thread to loop. But what will be like if the time is not enough to finish the loop before next thread start:
if threads: 2,
ramp-up: 10 secs,
loops: 500.
Let's say in first 5 seconds the server cannot finish 500 requests, and from sec 6 the thread2 starts. So there will be active requests from both part1 and part2 running at the same time.
Question 2 I'd assume, as within the loop it's sending one after another done, so there will always be 2 active requests (each 1 from 2 threads). By this way it has approximate 500 times of 2 concurrent threads. Is this understanding correct?
Does the above understanding sound correct?
JMeter starts all threads according to what you set in ramp-up period.
2 threads and 10 seconds ramp-up means that after 10 seconds you will have 2 threads up and running, JMeter will start 1 thread in 5 seconds.
Once started the thread begins executing Samplers upside down (or according to the Logic Controllers)
When thread executes last sampler it starts the new iteration immediately. When there are no more samplers to execute and loops to iterate the thread is being shut down.
When there are no more running threads the test ends.
Threads are absolutely independent. Each thread waits for the previous sampler to finish before starting the next sampler. Thread starts next iteration when the last sampler is executed, the other thread can still be running the previous iteration. If you want all of them to complete everything before starting the next iteration take a look at Synchronizing Timer or Inter-Thread Communication Plugin
I am working on developing a JMeter script for the following loads:
1 user
10 concurrent users
25 concurrent users
50 concurrent users
I have 4 different copies of the JMeter script having different ramp up time to cover these 4 cases.
There is a specific requirement as per which I need to record performance metrics by adding the load incrementally.
To put it simply I need to develop the JMeter script such that performance metrics are captured for all transactions for 1 user, 2 concurrent users, 3 concurrent users, 4 concurrent users, 5 concurrent users.... all the way till 50 users. So I want to understand is it possible to add threads or increase load incrementally as mentioned in the example while the JMeter script is being executed ?
Total Concurrency 12
Ramp Up Time (sec) 120
Ramp up step 4
In listener, sometime I have seen 17 user or sometimes 21.
I am expecting to have Total user with the group of 3
Concurrency Thread Group is running exactly that number of users as you define in the "Target Concurrency" field, not less, not more.
Here is the demo, I only changed 120 seconds to 12 to keep it reasonably short.
I can only think of one situation when the described behaviour is possible: running JMeter test in distributed mode. In that case the actual load will be 12 multiplied by the number of JMeter slave machines, for example:
1 slave - 12 threads
2 slaves - 24 threads
3 slaves - 36 threads
etc.
You can also check out jmeter.log file, it normally contains entries about starting and stopping threads and the reason for this, it might be the case you have more than one Thread Group or another component like Precise Throughput Timer or Throughput Shaping Timer or custom code in JSR223 Test Elements which kicks off extra threads.
I am not able to find out the specific answer of how to calculate the number of threads for running a load test in JMeter?
How to identify the loop count ?
Is there any formula?
What are the parameters to consider for the calculation?
Say if you want to fire 100 request to server with 2 tps. then your threas properties should be like below:
Number of threads(users) :2.
Ramp up period: 100
Loop count :50
Based on above example.Please find below explaination.
• Number of Threads (N): Sets the number of threads the JMeter will use to execute our test plan. We must know that each thread will execute the whole test plan, which effectively utilizes the number of users that could use the tested service at any given time simultaneously.
• Ramp-Up Period R: Specifies how much time (in seconds) it will take for JMeter to start all the threads (simultaneous user connections). If the number of users is 5 and the ramp-up time is 10 seconds, then each thread will be started in a 2 second delayed interval. We need to be careful when setting this value, because if the value is too high the first thread will already finish processing the whole test plan before the second thread will even begin. This is important because that would effectively reduce the number of concurrent users using the testing server application at any given time. But the ramp-up period also needs to be high enough to avoid starting all of the thread at a single time, which could overload the target application.
• Loop Count (L): How many times each thread group will loop through all configured elements belonging to that thread group.
Hope it helps!
I've noticed that when load testing with JMeter, if I do a single loop I get a fairly long average time for my test. If I have say a Loop Count of 10, my average time peaks early on and then drops way down. For example if I setup a test on a simple get request for a page with the following settings:
Number of Threads (users): 500
Ramp-up Period(in seconds): 5
Loop Count: 1
My average time is about 4 seconds. If I change it to 10 loops:
Number of Threads (users): 500
Ramp-up Period(in seconds): 5
Loop Count: 10
I get an average time of 1.4 seconds.
Apache's documentation states that the Loop Count is:
The number of times the subelements of this controller will be
iterated each time through a test run.
Is it possible that this means the first request will actually do something on the server and the subsequent 9 requests will be pulling from cache?
How exactly is the Loop Count being used that would cause the results I'm seeing?
Yes, Remaining 9 requests must be pulling from cache.
Loop controller is simple loop executor doing nothing magic inside.
Improved performance is because of use of cached results on server.
If you want one thing you can try, use the loop controller but use different substituted parameters so that every
time different requests will be sent to server (I know that loop controller is for repeating same values, but this is just to confirm the effect of caching).
then compare the results.
I hope this clears the doubt :)