jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <>
Subject Re: BeanShell's the only way to vary load?
Date Wed, 02 Dec 2009 19:56:01 GMT
Its custom code in beanshell you can write anything you want.  The only real
bit you need to know is (from the manual

* N.B. although the Timer is called the Constant Throughput timer, the
throughput value does not need to be constant. It can be defined in terms of
a variable or function call, and the value can be changed during a test. The
value can be changed in various ways: *

   - * using a counter variable *
   - * using a JavaScript or BeanShell function to provide a changing value
   - * using the remote BeanShell server to change a JMeter property *

Say you have written a java function that given a current time (say in 30
minute granularity) returns you the value of the throughput (how you
implement this is upto you , it may be as simple as maintaining a property
file keyed with HH_MM for every 30 minute interval and the function merely
converting the current time into HH_MM and reading the value , to as
complicated as writing the equation for the Gaussian Bell curve and
substituting values of times for it).
Then in BeanShell or java Samplers or javascript functions, invoke this ,
set the return value into a variable and use that variable in the timer (I
believe you can directly set the value into the timer as well), if the value
has changed.


On Wed, Dec 2, 2009 at 11:44 AM, Tech Newbie <> wrote:

> Can you expand on how to "vary Constant Throughput Timer using
> a function of say time or any other variable by writing custom code"?  I'm
> not aware of this capability.  This will be most suitable for my use case.
> Can you point me to some documentation or example?
> Thanks in advance.
> --- On Tue, 12/1/09, Deepak Shetty <> wrote:
> From: Deepak Shetty <>
> Subject: Re: BeanShell's the only way to vary load?
> To: "JMeter Users List" <>
> Date: Tuesday, December 1, 2009, 11:10 PM
> hi
> Ill make an attempt to answer , though bear in mind that I dont have any
> particular expertise in the topic you raise.
> Since the Constant throughput timer can be varied within the test itself
> (as
> a function of say time or any other variable by writing custom code) then I
> would prefer that approach to doing it externally (however this is much
> less
> flexible). Do you also need to distribute the tests to generate the load
> you
> need (irrespective of the mechanism used to vary the load)? if so having a
> self contained test is probably better.
> What are you trying to model? A system can show different characteristics
> for the same throughput. A user sending 100 requests in say 10 minutes may
> not be the same as 10 users each sending 10 requests in 10 minutes. In the
> latter case you are also looking to vary the number of active sessions
> instead of just the throughput and probably having multiple thread groups
> may be better.
> And lastly you cant have a 'best' way unless you determine what parameters
> are important to you. Is flexibility most important? runtime changes needed
> depending on how the system behaves? is maintaining/managing the test more
> important?
> regards
> deepak
> On Tue, Dec 1, 2009 at 2:30 PM, Tech Newbie <> wrote:
> > Looking for "best practice" to vary load in non-gui mode.
> >
> > I have a test plan that has a Constant Throughput Timer.  It is defined
> as
> > a JMeter property and a simple shell script passes in the property value
> on
> > JMeter's startup.
> >
> > I'd like to vary this load (bell-curve) over time (1 day).  I've read
> about
> > the approach using BeanShell server.  Is this the best way?  I'm
> hesitating
> > about this because it's another process to manage, in parallel with
> JMeter
> > itself.
> >
> > Other solutions I've comtemplated:
> >
> > - Extend the simple shell script to invoke mutiple instances of JMeter,
> > serially, with different values for the Constant Throughput Timer.
> >
> > - Create a test plan with multiple thread groups with different values
> for
> > the Constant Throughput Timer and have JMeter execute the thread group
> > serially.
> >
> > Please enlight me on the pros and cons.
> >
> > Thanks.
> >
> >
> >
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message