Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the thread count of test plan in JMeter, at run time

I want to change the number of threads for a JMeter test plan at runtime.

I have Googled my problem and found a proposed solution to use JMeter plugins. But in this solution I would have to schedule the thread group before running the test plan, which I don't want. I also found another potential solution which changes the property, but doesn't affect test plan behavior at run time.

Ultimately, what I am trying to do is change the thread number given in a thread group and have it immediately increase or decrease the number of threads in the current running test plan.

Is this possible?

like image 767
Anand Soni Avatar asked Apr 25 '12 08:04

Anand Soni


People also ask

How many threads can be executed at a time in JMeter?

JMeter allows you to run multiple processes in the same box, and it's usually pretty reliable generating up to 200 threads per JMeter instance. If you need more than that, I'd recommend using multiple JMeter instances. A modern machine with some tweaking can easily generate 500 to 1000 threads.

Which will control the amount of time JMeter will execute a test plan?

A timer will cause JMeter to delay a certain amount of time before each sampler which is in its scope. If you choose to add more than one timer to a Thread Group, JMeter takes the sum of the timers and pauses for that amount of time before executing the samplers to which the timers apply.

How do you run a JMeter test plan for specified time?

You can do this by using JMeter Scheduler: In Thread Group tick the Scheduler and set the value as below: Start Time and End Time: No need to input. keep them as they are, because they have no significant after entering Duration and Startup delay value. Delay overrides Start Time, and Duration overrides End Time.

How does JMeter calculate number of threads?

The formula for total server transaction throughput is <active threads> * 1 second / <1 thread response time>. Example calculations: when you have one thread (user) sending requests to server and server responds after 100ms, you have 1 thread * 1000ms / 100ms = 10 transactions per second.


2 Answers

IMHO that's just a fancy feature that has no real benefit when doing proper performance testing. In order to generate relevant test output (report), you need repeatability, and clearly defined test methodology and scenarios. In order to compare impact of any application/server/infrastructure changes, you need repeatability.

What do you mean by

We can't predict the user of our site

That's why we do performance testing at the first place. To find out what is our application/infrastructure limit.
I.e. the most significant metric you can produce is how your application response time changes when number of parallel users change. But not change erratically, in run time.

With jMeter plugins' Ultimate thread group you can cover any imaginable scenario.

like image 54
Marko Bonaci Avatar answered Sep 28 '22 13:09

Marko Bonaci


The short answer is: no, you cannot change the number of threads dynamically during runtime. Each thread count value is only read once when the test plan is first compiled and is not resolved again after this point, so it remains fixed.

like image 41
Oliver Lloyd Avatar answered Sep 28 '22 12:09

Oliver Lloyd