My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
ThroughputShapingTimer  

Timer
Updated May 30, 2011 by a...@apc.kg

Throughput Shaping Timer since 0.4.1

Long time JMeter users had to try their tests on and on, finding exact number of threads and timer delays that produce desires number of requests per second (RPS) to server. This is "closed workload" approach, and it has major drawbacks (see here why). And if you changed load generator machine or server response time - you were doomed to do all this stuff again.

Here's the solution - Throughput Shaping Timer! Now you can just set schedule of RPS easily, observing it on preview graph. This schedule can be as various as you want. It gives you the happiness of the "open workload" approach.

Few Important Notes

  1. JMeter test will be stopped when RPS schedule finishes.
  2. provide enough working threads for your RPS, JMeter timers can only delay threads (and limit RPS).
  3. if you have RPS that lower at the end of test, make threads to lower also. Оtherwise you'll have a spike in last second.
  4. avoid using zero RPS value as start of test, this produce spike also
  5. avoid zero RPS during the test, this may lead to nasty effects

How Many Threads I Need To Produce Desired RPS?

Threads pool size can be calculated like RPS * <max response time> / 1000. The more rate desired the more threads you will need. The more response time service have the more threads you will need.

For example, if your service response time may be 2.5sec and target rps is 1230, you have to have 1230 * 2500 / 1000 = 3075 threads.

It is better to have some threads overhead to handle unexpected response time spikes. But beware of too much overhead, it will lead to "final spike".

Example

Example JMX for Throughput Shaping Timer

Shaping Timer setting in example test plan:

Actual RPS provided:

Special Property Processing

There is a way to specify load pattern from special jmeter property load_profile. Property can be specified either in user.properties file (jmeter.properties also applicable), or from command line like -J "load_profile=...". Make note that this property is temporary, and will be replaced by some GUI setting in future versions.

Load pattern specified with set of function-like declarations. "Functions" may be of 3 types: const, line and step.

  • const(N, T) - hold constant load of N requests per second for T seconds
  • line(N, K, T) - linear increase load from N to K RPS during T seconds
  • step(N, K, S, T) - generate stepping load from N RPS to K rps, step height S RPS, step duration T seconds

Duration value in every function may be specified with shorthand case-insensitive modifiers:

  • s - seconds
  • m - minutes
  • h - hours
  • d - days

Duration setting may be combined like 1d11h23m6s.

Example of load profile string:

load_profile=const(10,10s) line(10,100,1m) step(5,25,5,1h)

Comment by anubhav...@gmail.com, Apr 28, 2011

Hi

How can we determine maximum number of threads required to generate certain amount RPS? For e.g. I want to achive 1000 RPS, how much threads should i define in jmeter?

Regards Anubhav

Comment by project member a...@apc.kg, Apr 28, 2011

Hi, I added notes on threads pool calculation to doc.

Comment by anubhav...@gmail.com, Apr 28, 2011

Thanks

Comment by furyke...@gmail.com, May 12, 2011

I must say I love this feature. It enable testing using open workload (with rps) instead of closed workload( with number of users). The response time of the system will be mucher higher in open workload in theory.

Good jobs!

Comment by oles.hod...@gmail.com, May 26, 2011

The formula for thread count calculation states "RPS <max response time>/1000", but the provided example "2500 1230 / 1000 = 3075" swaps RPS and <max response time>. Mathematically this is correct, but could be confusing to some readers.

Comment by project member a...@apc.kg, May 26, 2011

Thank you very much! Fixed!

Comment by dalves...@gmail.com, May 27, 2011

I need to run a RPS load for a long time, like 1-Week, but the Duration is specified in Seconds. I have found that even specifying just 20 hours in seconds (72000) causes JMeter to either freeze, or just takes far too long to adjust the graph (after a Clear All) and become responsive to new user actions for me to wait.

Am I missing something? Are these longer durations feasible with this timer?

Thanks in advance, David

Comment by project member a...@apc.kg, May 30, 2011

David, I think you don't miss anything, the graph maybe performs poorly with so long tests. Could you create an issue at issues tab? Mention there that you need some shorthands for duration (12h, 7d etc) and better graph performance. Just for me to remember to fix both problems!

Thahk you!

Comment by andrejva...@gmail.com, Jul 10, 2011

Hi,

Fairly new to JMeter and definitely to this plugin.

I was wondering how the test plan would look like if their are many transactions, each with its own frequency. Should I create a separate thread group for each transaction, or should I combine them somehow in one thread group? What would be the best practice?

Thank you!

Comment by project member a...@apc.kg, Jul 11, 2011

For open workload tests the better way is to use single Thread Group with enough threads and single Raw Sampler reading requests from pre-generated file. JMeter's problem with resources is because it do too much work generating data in runtime. Pre-generated data is the key for high-rate testing.

Comment by andrejva...@gmail.com, Jul 11, 2011

Do you mean the "HTTP Raw Sampler" from the JMeter Plugin?

And what is the best practice to divide the overall throughput for the thread group among the samplers? Should I use a "Throughput Controller" with percentages?

Comment by project member a...@apc.kg, Jul 11, 2011

Sorry, I don't know if Throughput Controller will help you here...

Comment by andrejva...@gmail.com, Jul 11, 2011

Thanks for your response. I am still trying to figure out what you actually meant. I guess you meant to use a HTTP Raw Sampler with a Raw Data Source available in the JMeter Plugins. The brief documentation sais it "allows load testing with huge datasets at high request rate". That part is clear and the way I want to go.

Though, you mention to run a single Raw Sampler. How can I use a single raw sampler for multiple different transactions, each with its own pre-defined throughput? Please enlighten me!

Comment by project member a...@apc.kg, Jul 11, 2011

The key is your pre-generated raw data file. You should generate it containing transactions with frequencies you want. So if you want 40% of your request to be tran1 and 60% of them to be tran2, the file should have those requests uniformly mixed in that proportion. Raw Data Source will read the file sequnetially, so sampler in each thread will send the requests in the proportion you generated...

Comment by andrejva...@gmail.com, Jul 11, 2011

Yep very clear, the difficulty becomes creating that file. Thanks for your help!

Comment by andrejva...@gmail.com, Jul 11, 2011

Ah one more question. Is there any way to put dynamic data in the requests at run-time? For example, I need to put the current time in one of the query string parameters. Guess not, but just asking...

Comment by project member a...@apc.kg, Jul 11, 2011

For data read from file - no. But it's the choice - either fast or complex logic.

Comment by andrejva...@gmail.com, Jul 11, 2011

Yes I understand. Another issue is that the unit in the binary file is an HTTP request, while in my test plan the unit is a transaction (which is composed of multiple HTTP requests). That will mess up the throughput which is bound to a transaction. Hmmmm.

Comment by project member a...@apc.kg, Jul 11, 2011

So Raw Request is not applicable here. Using JMeter native samplers out of this project scope.

Comment by andrejva...@gmail.com, Jul 11, 2011

I am not sure what you mean with out of project scope, but I can still use native sampler's with Throughput Shaping Timer.

Comment by project member a...@apc.kg, Jul 11, 2011

Sure you can. But dividing throughput between samplers still your task.

Comment by andrejva...@gmail.com, Jul 11, 2011

Back at the problem I started indeed. For others, dividing throughput among samplers can be done by the native Throughput Controller with a percentage of the global throughput for the thread group assigned to each sampler. Alternatively, one can scope the Throughput Shaping Timer at the sampler instead of the thread group.

Comment by furyke...@gmail.com, Jul 26, 2011

What is the inter arrival time distribution of the shaping time produce? Exponential(Poisson arrival of requests)? It seems the shaper will produce rather bursty traffic from an experiment setting( 100 threads, 40 rps, 0.004sec response time(processing time actually))

Comment by andrejva...@gmail.com, Aug 31, 2011

If I try to make a 24-hour schedule JMeter hangs. It was mentioned before in this thread that the graphs take to long to calculate. Is this fixed already?

Comment by project member a...@apc.kg, Aug 31, 2011

Please, give us some details: which version of plugins do you use and which exact schedule do you set?

Comment by manga...@gmail.com, Oct 11, 2011

Can this timer be used with any thread group or only certain ones? And for thread groups, does the runtime for thread group have to match this timer to some extent (longer, same duration, or shorter than timer schedule total). Like can this be used with a standard JMeter thread group set to loop forever or X loops (or will you have to set a schedule if using standard thread group)?

Comment by project member a...@apc.kg, Oct 12, 2011

Yes, this timer can be used with any thread group. When thread group finishes early than shaper schedule - that's it, we have nothing to shape. When shaper schedule finishes before threads (eg you have forever loops) it will ask JMeter to stop test.

Comment by manga...@gmail.com, Oct 19, 2011

Is this timer typically better used outside of thread group or in a thread group? The example shows it global to the test plan.

Comment by project member a...@apc.kg, Oct 19, 2011

It depends on your requirements. As usual JMeter timer it can be placed anywhere in Test Plan and will affect corresponding scope.

Comment by seft...@gmail.com, Feb 16, 2012

How to do less than one request per second? I enter a decimal and it just seems to go as fast as possible.

Comment by project member a...@apc.kg, Feb 17, 2012

Take a look into  issue 115 , maybe we'll have the support for non-integer rate

Powered by Google Project Hosting