You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Heinz Drews <he...@gmail.com> on 2011/08/18 12:40:40 UTC

Global counter

Hello,

I'm using a global CounterConfig which is incremented once per thread.
For testing I use following simple Testplan:

ThreadGroup (Threads 10)
+OnceOnlyController
++CounterConfig (Start 1, Increment 1, ref TC)
+DebugSampler
+WhileController
++DebugSampler

The DebugSampler inside the WhileController always shows the same
value per thread.
Thread 1 has value 1, Thread 2 has value 2 etc.

How can I get the actual value of the counter?

Thanks,
Heinz

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


Re: Global counter

Posted by Adrian Speteanu <as...@gmail.com>.
With long ramp ups, I often use Test Action (pause = x seconds - whatever I
need) and / or a thread synchronizing timer as child to the test action so
that the actions of each thread don't decay too much between themselves.

For "global counter", consider using the beanshell to implement whatever
logic is difficult with other JMeter tools.

On Thu, Aug 18, 2011 at 3:52 PM, sebb <se...@gmail.com> wrote:

> On 18 August 2011 13:35, Heinz Drews <he...@gmail.com> wrote:
> > Hello,
> >
> > because I was using the global option I was expecting that one
> > instance of the counter was used.
> >
> > I tried to place the CounterConfig as global element outside the
> > ThreadController and then tried to increment via the __counter()
> > function.
> > But this was also not giving me a global counter.
> >
> > The tested environment requires a long ramp-up period and I want to
> > avoid that the "early starters" are already terminated before the
> > ramp-up is completed.
> > That I wanted to achieve with help of a WhileController.
> >
> > Is there any alternative?
>
> Not sure it makes sense to artificially delay the end of early
> starters in order to ensure they are still running at the end of the
> ramp-up.
>
> Surely the idea is to ensure that everything is running normally, at
> the same time, at least for a while?
>
> If so, just ensure that every thread has enough real samples to ensure
> it lasts until ramp-up is completed.
> Use loops if necessary.
>
> If you don't want to wait for every thread to finishewind down
> afterwards, just set a duration which will stop the test earlier in
> the wind-down.
>
> > - Heinz
> >
> >
> >
> > On Thu, Aug 18, 2011 at 13:31, Adrian Speteanu <as...@gmail.com>
> wrote:
> >> Hi,
> >>
> >> According to the position of the counter, this is expected behaviour -
> you
> >> are getting the value of the counter as you can use it (if you need the
> max
> >> value of the counter at any time, I don't think this is how you want to
> >> approach this). You place the counter as child to the thread group as
> you
> >> did when you need it to be incremented with each new thread and with
> each
> >> new loop of any thread. The counter increments when its parent is used
> again
> >> (or enters the next loop), this is so so that you can you use the value
> of
> >> the counter in that exact thread & loop.
> >>
> >> Does this help?
> >>
> >> Adrian S
> >>
> >> On Thu, Aug 18, 2011 at 1:40 PM, Heinz Drews <he...@gmail.com>
> wrote:
> >>
> >>> Hello,
> >>>
> >>> I'm using a global CounterConfig which is incremented once per thread.
> >>> For testing I use following simple Testplan:
> >>>
> >>> ThreadGroup (Threads 10)
> >>> +OnceOnlyController
> >>> ++CounterConfig (Start 1, Increment 1, ref TC)
> >>> +DebugSampler
> >>> +WhileController
> >>> ++DebugSampler
> >>>
> >>> The DebugSampler inside the WhileController always shows the same
> >>> value per thread.
> >>> Thread 1 has value 1, Thread 2 has value 2 etc.
> >>>
> >>> How can I get the actual value of the counter?
> >>>
> >>> Thanks,
> >>> Heinz
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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: Global counter

Posted by sebb <se...@gmail.com>.
On 18 August 2011 13:35, Heinz Drews <he...@gmail.com> wrote:
> Hello,
>
> because I was using the global option I was expecting that one
> instance of the counter was used.
>
> I tried to place the CounterConfig as global element outside the
> ThreadController and then tried to increment via the __counter()
> function.
> But this was also not giving me a global counter.
>
> The tested environment requires a long ramp-up period and I want to
> avoid that the "early starters" are already terminated before the
> ramp-up is completed.
> That I wanted to achieve with help of a WhileController.
>
> Is there any alternative?

Not sure it makes sense to artificially delay the end of early
starters in order to ensure they are still running at the end of the
ramp-up.

Surely the idea is to ensure that everything is running normally, at
the same time, at least for a while?

If so, just ensure that every thread has enough real samples to ensure
it lasts until ramp-up is completed.
Use loops if necessary.

If you don't want to wait for every thread to finishewind down
afterwards, just set a duration which will stop the test earlier in
the wind-down.

> - Heinz
>
>
>
> On Thu, Aug 18, 2011 at 13:31, Adrian Speteanu <as...@gmail.com> wrote:
>> Hi,
>>
>> According to the position of the counter, this is expected behaviour - you
>> are getting the value of the counter as you can use it (if you need the max
>> value of the counter at any time, I don't think this is how you want to
>> approach this). You place the counter as child to the thread group as you
>> did when you need it to be incremented with each new thread and with each
>> new loop of any thread. The counter increments when its parent is used again
>> (or enters the next loop), this is so so that you can you use the value of
>> the counter in that exact thread & loop.
>>
>> Does this help?
>>
>> Adrian S
>>
>> On Thu, Aug 18, 2011 at 1:40 PM, Heinz Drews <he...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm using a global CounterConfig which is incremented once per thread.
>>> For testing I use following simple Testplan:
>>>
>>> ThreadGroup (Threads 10)
>>> +OnceOnlyController
>>> ++CounterConfig (Start 1, Increment 1, ref TC)
>>> +DebugSampler
>>> +WhileController
>>> ++DebugSampler
>>>
>>> The DebugSampler inside the WhileController always shows the same
>>> value per thread.
>>> Thread 1 has value 1, Thread 2 has value 2 etc.
>>>
>>> How can I get the actual value of the counter?
>>>
>>> Thanks,
>>> Heinz
>>>
>>> ---------------------------------------------------------------------
>>> 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: Global counter

Posted by Heinz Drews <he...@gmail.com>.
Hello,

because I was using the global option I was expecting that one
instance of the counter was used.

I tried to place the CounterConfig as global element outside the
ThreadController and then tried to increment via the __counter()
function.
But this was also not giving me a global counter.

The tested environment requires a long ramp-up period and I want to
avoid that the "early starters" are already terminated before the
ramp-up is completed.
That I wanted to achieve with help of a WhileController.

Is there any alternative?

- Heinz



On Thu, Aug 18, 2011 at 13:31, Adrian Speteanu <as...@gmail.com> wrote:
> Hi,
>
> According to the position of the counter, this is expected behaviour - you
> are getting the value of the counter as you can use it (if you need the max
> value of the counter at any time, I don't think this is how you want to
> approach this). You place the counter as child to the thread group as you
> did when you need it to be incremented with each new thread and with each
> new loop of any thread. The counter increments when its parent is used again
> (or enters the next loop), this is so so that you can you use the value of
> the counter in that exact thread & loop.
>
> Does this help?
>
> Adrian S
>
> On Thu, Aug 18, 2011 at 1:40 PM, Heinz Drews <he...@gmail.com> wrote:
>
>> Hello,
>>
>> I'm using a global CounterConfig which is incremented once per thread.
>> For testing I use following simple Testplan:
>>
>> ThreadGroup (Threads 10)
>> +OnceOnlyController
>> ++CounterConfig (Start 1, Increment 1, ref TC)
>> +DebugSampler
>> +WhileController
>> ++DebugSampler
>>
>> The DebugSampler inside the WhileController always shows the same
>> value per thread.
>> Thread 1 has value 1, Thread 2 has value 2 etc.
>>
>> How can I get the actual value of the counter?
>>
>> Thanks,
>> Heinz
>>
>> ---------------------------------------------------------------------
>> 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: Global counter

Posted by Adrian Speteanu <as...@gmail.com>.
Hi,

According to the position of the counter, this is expected behaviour - you
are getting the value of the counter as you can use it (if you need the max
value of the counter at any time, I don't think this is how you want to
approach this). You place the counter as child to the thread group as you
did when you need it to be incremented with each new thread and with each
new loop of any thread. The counter increments when its parent is used again
(or enters the next loop), this is so so that you can you use the value of
the counter in that exact thread & loop.

Does this help?

Adrian S

On Thu, Aug 18, 2011 at 1:40 PM, Heinz Drews <he...@gmail.com> wrote:

> Hello,
>
> I'm using a global CounterConfig which is incremented once per thread.
> For testing I use following simple Testplan:
>
> ThreadGroup (Threads 10)
> +OnceOnlyController
> ++CounterConfig (Start 1, Increment 1, ref TC)
> +DebugSampler
> +WhileController
> ++DebugSampler
>
> The DebugSampler inside the WhileController always shows the same
> value per thread.
> Thread 1 has value 1, Thread 2 has value 2 etc.
>
> How can I get the actual value of the counter?
>
> Thanks,
> Heinz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>