You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Pratapi Hemant Patel <he...@gmail.com> on 2015/03/25 18:10:21 UTC

Post processor executing less than sampler

Hi,

*Test plan, 5 thread, loop count 100*

I m using a http request sampler, and a BeanShell PostProcessor as a child
of this request,

Code of BeanShell PostProcessor is

float apdex_lower = Float.parseFloat(props.get("APDEX_LOWER"));
apdex_lower += 1;
props.put("APDEX_LOWER", Float.toString(apdex_lower));


So http request sampler is executing 500 times (also verified by summary
reprt listener)

but the value of APDEX_LOWER in property is less than 500, (470 to 490);


Thanks and Regards
Hemant
9013982184

Re: Post processor executing less than sampler

Posted by Pratapi Hemant Patel <he...@gmail.com>.
Hi all, thanks for quick reply,
I solved the problem using
1) Critical Section Controller
2) Synchronized in BeanShell

Thanks and Regards
Hemant
9013982184

On Thu, Mar 26, 2015 at 2:33 AM, Mark Wilkinson <in...@gmail.com> wrote:

> Or you could implement some kind of mutex (locking) mechanism but that's
> probably overkill for what you need.
>
> On 25 March 2015 at 20:54, Deepak Shetty <sh...@gmail.com> wrote:
>
> > >but the value of APDEX_LOWER in property is less than 500, (470 to 490);
> > You are using a multi-threaded system and using a shared variable (so if
> > two threads execute at exactly the same time they will read the same
> value
> > increment it and set it back ) - so the behavior above is expected.
> >
> > If you just need unique values then use thread numbers to determine
> buckets
> > (i.e thread 1 is 1-100 , thread 2  =101-200 etc). if you need the
> samplers
> > to really execute these variables incrementally then there you could use
> > JMeter Counter (element or function with a global counter) or Java +
> > synchronized - but there is no guarantee that the Sampler that executed
> the
> > block first will also make the HTTP request first
> >
> > On Wed, Mar 25, 2015 at 10:10 AM, Pratapi Hemant Patel <
> > hemantsonu20@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > *Test plan, 5 thread, loop count 100*
> > >
> > > I m using a http request sampler, and a BeanShell PostProcessor as a
> > child
> > > of this request,
> > >
> > > Code of BeanShell PostProcessor is
> > >
> > > float apdex_lower = Float.parseFloat(props.get("APDEX_LOWER"));
> > > apdex_lower += 1;
> > > props.put("APDEX_LOWER", Float.toString(apdex_lower));
> > >
> > >
> > > So http request sampler is executing 500 times (also verified by
> summary
> > > reprt listener)
> > >
> > > but the value of APDEX_LOWER in property is less than 500, (470 to
> 490);
> > >
> > >
> > > Thanks and Regards
> > > Hemant
> > > 9013982184
> > >
> >
>
>
>
> --
> Mark Wilkinson
> inyabass@gmail.com 07968 398828
>

Re: Post processor executing less than sampler

Posted by Mark Wilkinson <in...@gmail.com>.
Or you could implement some kind of mutex (locking) mechanism but that's
probably overkill for what you need.

On 25 March 2015 at 20:54, Deepak Shetty <sh...@gmail.com> wrote:

> >but the value of APDEX_LOWER in property is less than 500, (470 to 490);
> You are using a multi-threaded system and using a shared variable (so if
> two threads execute at exactly the same time they will read the same value
> increment it and set it back ) - so the behavior above is expected.
>
> If you just need unique values then use thread numbers to determine buckets
> (i.e thread 1 is 1-100 , thread 2  =101-200 etc). if you need the samplers
> to really execute these variables incrementally then there you could use
> JMeter Counter (element or function with a global counter) or Java +
> synchronized - but there is no guarantee that the Sampler that executed the
> block first will also make the HTTP request first
>
> On Wed, Mar 25, 2015 at 10:10 AM, Pratapi Hemant Patel <
> hemantsonu20@gmail.com> wrote:
>
> > Hi,
> >
> > *Test plan, 5 thread, loop count 100*
> >
> > I m using a http request sampler, and a BeanShell PostProcessor as a
> child
> > of this request,
> >
> > Code of BeanShell PostProcessor is
> >
> > float apdex_lower = Float.parseFloat(props.get("APDEX_LOWER"));
> > apdex_lower += 1;
> > props.put("APDEX_LOWER", Float.toString(apdex_lower));
> >
> >
> > So http request sampler is executing 500 times (also verified by summary
> > reprt listener)
> >
> > but the value of APDEX_LOWER in property is less than 500, (470 to 490);
> >
> >
> > Thanks and Regards
> > Hemant
> > 9013982184
> >
>



-- 
Mark Wilkinson
inyabass@gmail.com 07968 398828

Re: Post processor executing less than sampler

Posted by Deepak Shetty <sh...@gmail.com>.
>but the value of APDEX_LOWER in property is less than 500, (470 to 490);
You are using a multi-threaded system and using a shared variable (so if
two threads execute at exactly the same time they will read the same value
increment it and set it back ) - so the behavior above is expected.

If you just need unique values then use thread numbers to determine buckets
(i.e thread 1 is 1-100 , thread 2  =101-200 etc). if you need the samplers
to really execute these variables incrementally then there you could use
JMeter Counter (element or function with a global counter) or Java +
synchronized - but there is no guarantee that the Sampler that executed the
block first will also make the HTTP request first

On Wed, Mar 25, 2015 at 10:10 AM, Pratapi Hemant Patel <
hemantsonu20@gmail.com> wrote:

> Hi,
>
> *Test plan, 5 thread, loop count 100*
>
> I m using a http request sampler, and a BeanShell PostProcessor as a child
> of this request,
>
> Code of BeanShell PostProcessor is
>
> float apdex_lower = Float.parseFloat(props.get("APDEX_LOWER"));
> apdex_lower += 1;
> props.put("APDEX_LOWER", Float.toString(apdex_lower));
>
>
> So http request sampler is executing 500 times (also verified by summary
> reprt listener)
>
> but the value of APDEX_LOWER in property is less than 500, (470 to 490);
>
>
> Thanks and Regards
> Hemant
> 9013982184
>