You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Tom Fernandes <an...@gmx.net> on 2008/03/10 16:29:56 UTC

probablilty of occurence

Hi,

If I want to run a certain request with the probability of e.g. 12% I would 
use the Troughput controller.

Now I would like to run a request A with the probability of 1.2% and the 
subsequent (child of) request B only with the probability of 0.8374% 
occurrence. Request C is child of request B and occurs only with a 
probability of 0.234456%.

The percentages are not relative to each other but based on an over-all 
statistic of websites accessed on the webserver (page-impressions).


How would create this behavior with jmeter?


thanks,


Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by Tom Fernandes <an...@gmx.net>.
Hi,

On Monday, 10. March 2008, sebb wrote:
> On 10/03/2008, Tom Fernandes <an...@gmx.net> wrote:
> > Hi,
> >
> >  On Monday, 10. March 2008, Steve Miller wrote:
> >  > Tom,
> >  >
> >  > If you don't want to use an int as an approximation, maybe you can
> >  > find some way to use the __Random to generate a pseudo-random number
> >  > in a large range, e.g. 0-1,000,000, then test the random number for
> >  > the percentage that you want. E.g. in pseudocode
> >  >
> >  > if ($__Random(1,1000000) < (1,000,000*0.83274/100)) ...
> >
> > okay this seems to work for me (it took me a bit to get it).
> >
> >  I'm now having ${__Random(1,1000000,NUM)} in a variable but each thread
> > will get executed with the same number returned from the function - how
> > can I change that behavior?
>
> Where are you definining the variable/referencing the function?

It works now. I actually have a user defined variable field.

Name: dummy_1; value:  ${__Random(1,1000000,NUM_1)}

I tried to use ${dummy_1} to reference to the number which always gave me the 
same number in a thread. Now that I use ${NUM} it works.

It would be sufficient for me to have one var for the random number, but if I 
access $NUM_1 again later in the next if-controller it will use the same 
number like before. that's why I'm having name-value-pairs like 

Name: dummy_2; value:  ${__Random(1,1000000,NUM_2)}
Name: dummy_3; value:  ${__Random(1,1000000,NUM_3)}

now. It works - but for cosmetic reason - isn't there a better way?

I actually tried to create the random number directly in the if-controller 
using JS - but that didn't work.


thanks so far again,


Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by sebb <se...@gmail.com>.
On 10/03/2008, Tom Fernandes <an...@gmx.net> wrote:
> Hi,
>
>
>  On Monday, 10. March 2008, Steve Miller wrote:
>  > Tom,
>  >
>  > If you don't want to use an int as an approximation, maybe you can find
>  > some way to use the __Random to generate a pseudo-random number in a
>  > large range, e.g. 0-1,000,000, then test the random number for the
>  > percentage that you want. E.g. in pseudocode
>  >
>  > if ($__Random(1,1000000) < (1,000,000*0.83274/100)) ...
>
>
> okay this seems to work for me (it took me a bit to get it).
>
>  I'm now having ${__Random(1,1000000,NUM)} in a variable but each thread will
>  get executed with the same number returned from the function - how can I
>  change that behavior?
>

Where are you definining the variable/referencing the function?

>
>  regards,
>
>
>  Tom
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by Tom Fernandes <an...@gmx.net>.
Hi,

On Monday, 10. March 2008, Steve Miller wrote:
> Tom,
>
> If you don't want to use an int as an approximation, maybe you can find
> some way to use the __Random to generate a pseudo-random number in a
> large range, e.g. 0-1,000,000, then test the random number for the
> percentage that you want. E.g. in pseudocode
>
> if ($__Random(1,1000000) < (1,000,000*0.83274/100)) ...

okay this seems to work for me (it took me a bit to get it).

I'm now having ${__Random(1,1000000,NUM)} in a variable but each thread will 
get executed with the same number returned from the function - how can I 
change that behavior?


regards,


Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by Tom Fernandes <an...@gmx.net>.
Hi,

Our calculation is the following:
Out of 10 page hits on page A, B, C, D ...

1 hit on page A
0.8 on page B
0.072 hits on page C
0.128 hits on page D
...

until it sums up to 10. So if 1 person accesses page A it is 0.8% (out of the 
10) likely that he will proceed to page B. If he is on page B it is 0.072% 
(out of the 10) likely that he will open page C. If he is on page C it is 
0.123% (out of the same 10 again) likely that he will access page D.

Our application is build that you will have to access page A to get to page B 
and have to access B to get to page C and so on.
So e.g. out of 100 visitors on page A only 8 will proceed to page B. The other 
92 will just not continue further and for those the thread will be over.

As we have to keep the sequence for our application to work we can't have 
different threads accessing the different pages.

Any pointers how to do that?


On Monday, 10. March 2008, Steve Miller wrote:
> Tom,
>
> If you don't want to use an int as an approximation, maybe you can find
> some way to use the __Random to generate a pseudo-random number in a
> large range, e.g. 0-1,000,000, then test the random number for the
> percentage that you want. E.g. in pseudocode
>
> if ($__Random(1,1000000) < (1,000,000*0.83274/100)) ...


I'm not sure if this would work. It also seem like the system would calculate 
a lot which might hog jmeter - but I might be wrong.


thanks,


Tom

>
> then figure out how to get conditional test execution based on that
> result. (I've only used a small subset of JMeter so far...not sure best
> way to do that.)
>
> Steve
>
> sebb wrote:
> > On 10/03/2008, Tom Fernandes <an...@gmx.net> wrote:
> >> Hello again,
> >>
> >>  On Monday, 10. March 2008, Tom Fernandes wrote:
> >>  > Hi,
> >>  >
> >>  > If I want to run a certain request with the probability of e.g. 12% I
> >>  > would use the Troughput controller.
> >>  >
> >>  > Now I would like to run a request A with the probability of 1.2% and
> >>  > the subsequent (child of) request B only with the probability of
> >>  > 0.8374% occurrence. Request C is child of request B and occurs only
> >>  > with a probability of 0.234456%.
> >>
> >> It does look like that I can give percentage numbers <0 and / or
> >> floating points with the Throughput controller. So I could give 1.2% or
> >> 0.234456% in the percentage field?
> >>
> >>  Is that correct?
> >
> > No.
> >
> > The docs say:
> >
> > "A number. for percent execution mode, a number from 0-100"
> >
> > and the code uses an int to hold the value.
> >
> >>  regards,
> >>
> >>
> >>
> >>  Tom
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by Steve Miller <st...@openwave.com>.
Tom,

If you don't want to use an int as an approximation, maybe you can find 
some way to use the __Random to generate a pseudo-random number in a 
large range, e.g. 0-1,000,000, then test the random number for the 
percentage that you want. E.g. in pseudocode

if ($__Random(1,1000000) < (1,000,000*0.83274/100)) ...

then figure out how to get conditional test execution based on that 
result. (I've only used a small subset of JMeter so far...not sure best 
way to do that.)

Steve

sebb wrote:
> On 10/03/2008, Tom Fernandes <an...@gmx.net> wrote:
>   
>> Hello again,
>>
>>
>>
>>  On Monday, 10. March 2008, Tom Fernandes wrote:
>>  > Hi,
>>  >
>>  > If I want to run a certain request with the probability of e.g. 12% I would
>>  > use the Troughput controller.
>>  >
>>  > Now I would like to run a request A with the probability of 1.2% and the
>>  > subsequent (child of) request B only with the probability of 0.8374%
>>  > occurrence. Request C is child of request B and occurs only with a
>>  > probability of 0.234456%.
>>
>>
>> It does look like that I can give percentage numbers <0 and / or floating
>>  points with the Throughput controller. So I could give 1.2% or 0.234456% in
>>  the percentage field?
>>
>>  Is that correct?
>>     
>
> No.
>
> The docs say:
>
> "A number. for percent execution mode, a number from 0-100"
>
> and the code uses an int to hold the value.
>
>   
>>  regards,
>>
>>
>>
>>  Tom
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by sebb <se...@gmail.com>.
On 10/03/2008, Tom Fernandes <an...@gmx.net> wrote:
> Hello again,
>
>
>
>  On Monday, 10. March 2008, Tom Fernandes wrote:
>  > Hi,
>  >
>  > If I want to run a certain request with the probability of e.g. 12% I would
>  > use the Troughput controller.
>  >
>  > Now I would like to run a request A with the probability of 1.2% and the
>  > subsequent (child of) request B only with the probability of 0.8374%
>  > occurrence. Request C is child of request B and occurs only with a
>  > probability of 0.234456%.
>
>
> It does look like that I can give percentage numbers <0 and / or floating
>  points with the Throughput controller. So I could give 1.2% or 0.234456% in
>  the percentage field?
>
>  Is that correct?

No.

The docs say:

"A number. for percent execution mode, a number from 0-100"

and the code uses an int to hold the value.

>
>  regards,
>
>
>
>  Tom
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: probablilty of occurence

Posted by Tom Fernandes <an...@gmx.net>.
Hello again,


On Monday, 10. March 2008, Tom Fernandes wrote:
> Hi,
>
> If I want to run a certain request with the probability of e.g. 12% I would
> use the Troughput controller.
>
> Now I would like to run a request A with the probability of 1.2% and the
> subsequent (child of) request B only with the probability of 0.8374%
> occurrence. Request C is child of request B and occurs only with a
> probability of 0.234456%.

It does look like that I can give percentage numbers <0 and / or floating 
points with the Throughput controller. So I could give 1.2% or 0.234456% in 
the percentage field?

Is that correct?


regards,


Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org