You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Andrej van der Zee <an...@gmail.com> on 2008/01/20 08:04:13 UTC

synchronized samples

Hi,

I am new to JMeter and I have an issue I am not able to solve. I was hoping
to get some help here :)

My problem is best explained with a example, so suppose I have the following
setup:

Thread Group
-- Login (HTTP Request)
-- Visit Page (HTTP Request)
-- Logout (HTTP Request)

Now I would like to start 10 threads that first all execute "HTTP Request
Login" *one after each other*. So first thread_1 would  execute "Login" and
after it finishes, thread_2 would immediately execute "Login", etc...

Then, after all 10 threads executed the "Login", I would like to pause 10
seconds before going to the next stage. After the pause, I would like to
execute "Visit Page" for all threads in the same way as "Login", and then
have another 10 seconds pause, etc.

I realize this breaks the idea of concurrent users, but this is for a
reason.

Hope you can help!
Andrej

Re: synchronized samples

Posted by sebb <se...@gmail.com>.
On 20/01/2008, Andrej van der Zee <an...@gmail.com> wrote:
> Hi,
>
> Thanks for the reply.
>
> I don't really understand how this can solve my problem. Suppose I have a
> thread group of 10 threads and want to execute the first HTTP Request for
> all 10 threads *sequentially,* before moving to the next HTTP Request. So
> what I need is that 2 threads will *never* execute the HTTP Sampler at the
> same time, *but only right after each other*. In C/C++ this could be
> implemented with a mutex and functions like wait() and notify(), to make
> sure that only one thread is executing some critical code (the HTTP Request
> in this case) at the same time.
>

JMeter threads are intended to simulate independent users, so
generally the focus is on ensuring that threads *don't* have to wait
for each other.

The Synchronizing Timer is about the only test element that allows
threads to wait for each other; however it is not what you want.

There's an enhancement request (with patch) for adding semaphores as
test elements:

http://issues.apache.org/bugzilla/attachment.cgi?id=20817

It requires Java 1.5.

> Is this possible with the Interleave Controller?
>
> Thanks,
> Andrej
>
>
>
> On Jan 20, 2008 10:03 PM, matthew sporleder <ms...@gmail.com> wrote:
>
> > On 1/20/08, Andrej van der Zee <an...@gmail.com> wrote:
> > > Hi,
> > >
> > > I am new to JMeter and I have an issue I am not able to solve. I was
> > hoping
> > > to get some help here :)
> > >
> > > My problem is best explained with a example, so suppose I have the
> > following
> > > setup:
> > >
> > > Thread Group
> > > -- Login (HTTP Request)
> > > -- Visit Page (HTTP Request)
> > > -- Logout (HTTP Request)
> > >
> > > Now I would like to start 10 threads that first all execute "HTTP
> > Request
> > > Login" *one after each other*. So first thread_1 would  execute "Login"
> > and
> > > after it finishes, thread_2 would immediately execute "Login", etc...
> > >
> > > Then, after all 10 threads executed the "Login", I would like to pause
> > 10
> > > seconds before going to the next stage. After the pause, I would like to
> > > execute "Visit Page" for all threads in the same way as "Login", and
> > then
> > > have another 10 seconds pause, etc.
> > >
> > > I realize this breaks the idea of concurrent users, but this is for a
> > > reason.
> > >
> >
> > I think you could use the interleave controller, a timer, and a
> > function to calculate how long you waited (10-$x where $x=thread id,
> > or something like that).
> >
> >
> > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Interleave_Controller
> > http://jakarta.apache.org/jmeter/usermanual/test_plan.html#timers
> > http://jakarta.apache.org/jmeter/usermanual/functions.html
> >
> > ---------------------------------------------------------------------
> > 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: synchronized samples

Posted by Andrej van der Zee <an...@gmail.com>.
Hi,

Thanks for the reply.

I don't really understand how this can solve my problem. Suppose I have a
thread group of 10 threads and want to execute the first HTTP Request for
all 10 threads *sequentially,* before moving to the next HTTP Request. So
what I need is that 2 threads will *never* execute the HTTP Sampler at the
same time, *but only right after each other*. In C/C++ this could be
implemented with a mutex and functions like wait() and notify(), to make
sure that only one thread is executing some critical code (the HTTP Request
in this case) at the same time.

Is this possible with the Interleave Controller?

Thanks,
Andrej



On Jan 20, 2008 10:03 PM, matthew sporleder <ms...@gmail.com> wrote:

> On 1/20/08, Andrej van der Zee <an...@gmail.com> wrote:
> > Hi,
> >
> > I am new to JMeter and I have an issue I am not able to solve. I was
> hoping
> > to get some help here :)
> >
> > My problem is best explained with a example, so suppose I have the
> following
> > setup:
> >
> > Thread Group
> > -- Login (HTTP Request)
> > -- Visit Page (HTTP Request)
> > -- Logout (HTTP Request)
> >
> > Now I would like to start 10 threads that first all execute "HTTP
> Request
> > Login" *one after each other*. So first thread_1 would  execute "Login"
> and
> > after it finishes, thread_2 would immediately execute "Login", etc...
> >
> > Then, after all 10 threads executed the "Login", I would like to pause
> 10
> > seconds before going to the next stage. After the pause, I would like to
> > execute "Visit Page" for all threads in the same way as "Login", and
> then
> > have another 10 seconds pause, etc.
> >
> > I realize this breaks the idea of concurrent users, but this is for a
> > reason.
> >
>
> I think you could use the interleave controller, a timer, and a
> function to calculate how long you waited (10-$x where $x=thread id,
> or something like that).
>
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Interleave_Controller
> http://jakarta.apache.org/jmeter/usermanual/test_plan.html#timers
> http://jakarta.apache.org/jmeter/usermanual/functions.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: synchronized samples

Posted by matthew sporleder <ms...@gmail.com>.
On 1/20/08, Andrej van der Zee <an...@gmail.com> wrote:
> Hi,
>
> I am new to JMeter and I have an issue I am not able to solve. I was hoping
> to get some help here :)
>
> My problem is best explained with a example, so suppose I have the following
> setup:
>
> Thread Group
> -- Login (HTTP Request)
> -- Visit Page (HTTP Request)
> -- Logout (HTTP Request)
>
> Now I would like to start 10 threads that first all execute "HTTP Request
> Login" *one after each other*. So first thread_1 would  execute "Login" and
> after it finishes, thread_2 would immediately execute "Login", etc...
>
> Then, after all 10 threads executed the "Login", I would like to pause 10
> seconds before going to the next stage. After the pause, I would like to
> execute "Visit Page" for all threads in the same way as "Login", and then
> have another 10 seconds pause, etc.
>
> I realize this breaks the idea of concurrent users, but this is for a
> reason.
>

I think you could use the interleave controller, a timer, and a
function to calculate how long you waited (10-$x where $x=thread id,
or something like that).

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Interleave_Controller
http://jakarta.apache.org/jmeter/usermanual/test_plan.html#timers
http://jakarta.apache.org/jmeter/usermanual/functions.html

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