# jmeter-user mailing list archives

##### Site index · List index
Message view
Top
From "Jonathan O'Keeffe" <jokee...@attbi.com>
Subject RE: Timer Question
Date Wed, 04 Sep 2002 00:14:34 GMT
```Amir -

value.

On your #2, Random.nextDouble() returns a value that is in the range [0.0,
1.0), with an even distribution throughout the range.  Random.nextGaussian
produces a value that has a "normal" or Gaussian distribution (a
bell-shaped curve), with a mean of 0.0 and a standard distribution of 1.0.
This means that it will produce both positive and negative values, and that
values closer to zero are more likely to be returned than values farther
from zero (roughly speaking).

As a practical matter with respect to the Timer services, this means that
if you have a UniformRandomTimer with a random delay of 1000 ms and a
constant offset of 5000 ms, you will get delays in the range [5000, 6000)
ms, and every delay in the range will be equally likely to occur - a delay
of 5001 ms is just as likely as a delay of 5999 ms.

If you have a GaussianRandomTimer with a random delay of 1000 ms and a
constant offset of 5000, you will get delays centered around 5000 ms with a
bell-shaped distribution that has a standard deviation of 1000. Most values
(around 95%) will be between 3000 and 7000, and many of them (around 68%)
will be between 4000 and 6000.  However, there will be some outliers -
occasionally you might get a delay of 1500 ms, or 9000 ms, or something
like that, although these extreme values will be very uncommon.

A Gaussian distribution like the one obtained from GaussianRandomTimer is
often a good way to model real-world phenomena.  For example, if you're
trying to model an application where the user spends an average of 10
seconds looking at a page before moving on to the next page, a
GaussianRandomTimer with an offset of 10000 ms and a delay of around 2000
will produce values that look a lot like the real-world times that people

To get a better sense for how this works, you can write a simple test, like
this:

RandomTimer timer = new GaussianRandomTimer();
timer.setDelay(5000);
timer.setRange(1000);
System.out.println("Gaussian Delays");
for (int i = 0; i < 100; ++i) {
System.out.println(timer.delay());
}

timer = new UniformRandomTimer();
timer.setDelay(5000);
timer.setRange(1000);
System.out.println("Uniform Delays");
for (int i = 0; i < 100; ++i) {
System.out.println(timer.delay());
}

Take a look at the values that get generated, or paste them into Excel, and
the difference should become clear.

Hope this helps.

- Jonathan

-----Original Message-----
From: Amir Nashat [mailto:anashat@CJ.COM]
Sent: Tuesday, September 03, 2002 7:16 PM
To: jmeter-user@jakarta.apache.org
Subject: Re: Timer Question

Mike,

Thank you for your response. It was very helpful. I plugged away some
values and played with the UI and seem to have a better understanding of
how the timers work.

I have come along a couple of more questions in which I was wondering if
you could help out. They are:

1) Assume you have 2 threads ( or samples as you call them) and you are
using a UniformRandomTimer. The random delay in milliseconds is 1000 and
the constant delay is 5000 milliseconds. Now the UniformRandomTimer service
takes these two values and spits out a delay for the first thread. Does the
second thread then also call the UniformRandomTimer service and get its own
delay as well or is the first delay that was calculated used for both
uniquely and generates its own delay using the random delay and constant
delay mentioned above.

2) In looking through the source code for UniformRandomTimer and
GaussianRandomTimer they both use methods from the Random class. Looking
through the Random API I can't really differentiate how nextDouble and
nextGaussian really generate different results. Thus, I can't see the
difference between the Uniform and Gaussian Timer services. Basically, if
you use the same values for the random delay(let's say 1000 ms) and
constant delay(say 5000 ms) for the Uniform timer as for the
deviation(again 1000 ms) and constant delay (again 5000 ms) how would the
results differ?

Sorry if I have made this a bigger mess then I probably need to but I would
like to get a clear understanding of the delay that these services provide
in order to simulate a real world environment.

amir

>>> mstover1@apache.org 1:55:57 PM 09/03/02 >>>
Constant timer creates a delay between each sample that is the same for all
samples.

Gaussian random creates a delay that will average X milliseconds, but in
such a
way as to create a bell-shaped distribution around that average.  The
average is
the sum of the offset (minimum delay) and the deviation (the range of
values).

Uniform random timer creates a uniform distribution around the average.

-Mike

On 3 Sep 2002 at 10:25, Amir Nashat wrote:

> Hello all,
>
> I asked this on Friday but I have had no response so I will ask again.
Can anyone explain the difference between the timer options? The
documentation is pretty sparse. Any examples of which to use in what
situation would be helpful. I have researched the faq, help and gone
not much has been explained. Any help would be appreciated.
>
>
> TIA
> amir
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:jmeter-user-unsubscribe@jakarta.apache.org>
<mailto:jmeter-user-help@jakarta.apache.org>
>

--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688

--
To unsubscribe, e-mail:
<mailto:jmeter-user-unsubscribe@jakarta.apache.org>
<mailto:jmeter-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:jmeter-user-unsubscribe@jakarta.apache.org>