Are the simulation loops separate? With separate I mean that JMeter waits for all threads to be done to begin a new iteration of the loop. Or does JMeter just let every thread do a request X time, without stopping?
Additional question: Could one change the number of threads dynamically? Doing a simulation for a range of number of thread (e.g. 100-1500) would be nice.
Each thread is completely independent. So when you have loop set, if a thread is finished its first loop of execution, it goes for another round (as per the loop count) irrespective of the completion of other threads.
You can use a variable for the number of threads & set the number via property files etc. But when the test is running, you can not change the no of threads for the test.
Hope it is clear!
In addition to vIns answer:
You CAN change load dynamically during execution. Threads count is static, but their fire rate is something you can impact.
Look into combination of Beanshell Server and Constant Throughput Timer.
Related
Fairly new to JMeter and I have the requirement to start a new thread (Usercall) based on a poisson timer. I figured out how to create a poisson timer but not how to start a new thread based on a poisson timer. When I add the poisson timer in a dummy sampler at the start of the threadgroup it still executes the treads in parallel of course.
Goal would be to control the amount of threads by manipulating the poisson timer.
Edit:
So I would set the Poisson timer so that most calls will happen between 0 and 7 seconds. It would start a thread which would then execute a business case on the system. Next thread should be again started between 0 and 7 seconds and run in parallel with the first one. After the threads would run thru they close. This way it should not result in 1000 open threads and you can control the threads dynamically with the timer
If you're looking for a way to start threads with random delays I'm afraid that the only way is doing it using JSR223 Test Elements and Groovy language. Take a look at ThreadGroup.addNewThread() function.
Example code:
ctx.getThreadGroup().addNewThread(org.apache.commons.lang3.RandomUtils.nextInt(0, 7), ctx.getEngine())
However I fail to see why just not to go for the Poisson Random Timer, even if you start all the threads at the same time if you put the timer as a child of the 1st sampler the threads won't execute anything as the timer will add the delay.
I am running JMeter with number of threads=10,60,140 for the multiple thread groups and We are getting high response time.
If we changed recording controller to loop controller and same values given in loop count, then we are getting least response time.
Why there is a difference between them? Which response should we consider?
Threads are executed in parallel while loop is executed samplers sequentially.
Executing numerous calls in parallel on same machine versus sequentially is basically creating more stress on server (more hits per seconds).
When server is under stress there may appears waits/locks because of reaching max number of X, where X can be either database/server/resource/...
Therefore your response time will be higher when using threads over loop number.
Instead of this approaches, you probably should consider try to simulate real users behavior, see for more details an answer.
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!
When I'm doing Jmeter benchmark, the throughput and transfer bytes/sec keep decreasing as time goes by? Who can tell me why?
When the test begins, it has a high throughput , but it decreases all time, and the stable status can't be accessed.
JMeter kicks off threads representing virtual users according to your ramp-up. Each thread starts executing samplers upside down (or according to parent Logic Controllers). When thread doesn't have more samplers to execute and no more loops to iterate it's being shut down.
You can consider the following approaches to implement desired load scenario:
Provide enough iterations via Thread Group or Loop Contoller
Use Ultimate Thread Group which provides easy way of defining a load scenario so you will be able to set initial users number, ramp up duration and users arrival rate, time to hold the load, and define ramp-down.
JMeter provides Constant Throughput Timer which can be used to set precise load in "requests per minute" so you'll be able to control target throughput. You can also use it in conjunction with Beanshell Server - this way you can dynamically change throughput on-the-fly.
I would like to run the test with the given execution rate per second. The next iteration should start asynchronously at 2nd second without waiting for completion of first iteration.
I tried with Constant Throughput Timer but it doesn't proceed to next iteration until
it finish getting response of first iteration threads.
You can use 2 separate Thread Groups for this (make sure that you have Run Thread Groups Consecutively box unchecked at Test Plan level.
Also check your Constant Throughput Timer configuration Calculate Throughput based on field, you may wish to have separate timer for each Thread Group.
By the way, there is more advanced Throughput Shaping Timer element available via plugin which provides easy-readable graph demonstrating the load pattern.
If you will be considering using separate Thread Groups remember that JMeter Variables have scope local to the Thread Group where they are defined. To use them across different Thread Groups you'll need to cast them to JMeter Properties which have "global" scope. See How to Use Variables in Different Thread Groups guide for how to implement it.
A single thread can only handle one request at a time. You'll need more than one thread for what you're asking for. The constant throughput timer can indeed do what you're asking as long as you have enough threads.
In order to achieve what you're asking for (lets say 1 request every second, regardless of how long the request takes) you could I would suggest using a large number of threads and using the CTT for 60 requests per second.