Handling Asynchronous API Call in Jmeter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Handling Asynchronous API Call in Jmeter

pratik thorve
Hello All,

I am stuck with the below problem and need help from the experts !
I am using Jmeter for functional test purpose (Please dont curse me on this
:( )
We have configured 1 thread group as 1 TC.
So in my 1 thread i have all the steps that are related to 1 TC.

Problem :

First TC consists of 2 Call (Samplers) , API Call and JMS Point to Point
message.
Now the flow is :
1) Do the API call and wait for results (it works for 60 sec (running) and
then return the results)
2) Send the message to JMS (Active MQ)

Now the API call will return a success message only when the second step is
executed.
But since Jmeter executes the samplers one by one , my exeuction is stuck
at first step.
The second step is executed only when the first step (api call) is
completed.

I want to the run the first step (api call) , then trigger the seconds step
(while the first step is still under execution)
So that the message from the seconds step can be processed by the
application and get the result for the same in 1st step

Tried and Not working :
Used parallel executor and put both the samplers under the same , so that
they are triggered together.
Then added a delay to the seconds step.
Looks like the delay does not work and both the request are sent at the
same time.

Please let me know if there is any way i can implement this.


Pratik
Reply | Threaded
Open this post in threaded view
|

Re: Handling Asynchronous API Call in Jmeter

niraj
How about adding two thread groups? API call within first thread group and
Message to JMS will be in other. Add Startup delay in the second thread
group. This should work i guess.

On Mon, Aug 19, 2019 at 1:28 PM pratik thorve <[hidden email]>
wrote:

> Hello All,
>
> I am stuck with the below problem and need help from the experts !
> I am using Jmeter for functional test purpose (Please dont curse me on this
> :( )
> We have configured 1 thread group as 1 TC.
> So in my 1 thread i have all the steps that are related to 1 TC.
>
> Problem :
>
> First TC consists of 2 Call (Samplers) , API Call and JMS Point to Point
> message.
> Now the flow is :
> 1) Do the API call and wait for results (it works for 60 sec (running) and
> then return the results)
> 2) Send the message to JMS (Active MQ)
>
> Now the API call will return a success message only when the second step is
> executed.
> But since Jmeter executes the samplers one by one , my exeuction is stuck
> at first step.
> The second step is executed only when the first step (api call) is
> completed.
>
> I want to the run the first step (api call) , then trigger the seconds step
> (while the first step is still under execution)
> So that the message from the seconds step can be processed by the
> application and get the result for the same in 1st step
>
> Tried and Not working :
> Used parallel executor and put both the samplers under the same , so that
> they are triggered together.
> Then added a delay to the seconds step.
> Looks like the delay does not work and both the request are sent at the
> same time.
>
> Please let me know if there is any way i can implement this.
>
>
> Pratik
>
Reply | Threaded
Open this post in threaded view
|

Re: Handling Asynchronous API Call in Jmeter

pratik thorve
Adding 2 thread group will solve the problem but it will create issue when
i need to report the results as we are considering 1 thread group as 1TC.

On Mon, Aug 19, 2019 at 12:26 PM Niraj <[hidden email]> wrote:

> How about adding two thread groups? API call within first thread group and
> Message to JMS will be in other. Add Startup delay in the second thread
> group. This should work i guess.
>
> On Mon, Aug 19, 2019 at 1:28 PM pratik thorve <[hidden email]>
> wrote:
>
> > Hello All,
> >
> > I am stuck with the below problem and need help from the experts !
> > I am using Jmeter for functional test purpose (Please dont curse me on
> this
> > :( )
> > We have configured 1 thread group as 1 TC.
> > So in my 1 thread i have all the steps that are related to 1 TC.
> >
> > Problem :
> >
> > First TC consists of 2 Call (Samplers) , API Call and JMS Point to Point
> > message.
> > Now the flow is :
> > 1) Do the API call and wait for results (it works for 60 sec (running)
> and
> > then return the results)
> > 2) Send the message to JMS (Active MQ)
> >
> > Now the API call will return a success message only when the second step
> is
> > executed.
> > But since Jmeter executes the samplers one by one , my exeuction is stuck
> > at first step.
> > The second step is executed only when the first step (api call) is
> > completed.
> >
> > I want to the run the first step (api call) , then trigger the seconds
> step
> > (while the first step is still under execution)
> > So that the message from the seconds step can be processed by the
> > application and get the result for the same in 1st step
> >
> > Tried and Not working :
> > Used parallel executor and put both the samplers under the same , so that
> > they are triggered together.
> > Then added a delay to the seconds step.
> > Looks like the delay does not work and both the request are sent at the
> > same time.
> >
> > Please let me know if there is any way i can implement this.
> >
> >
> > Pratik
> >
>


--
Regards ,
Pratik Thorve
Reply | Threaded
Open this post in threaded view
|

Re: Handling Asynchronous API Call in Jmeter

Srikrishna Dandamraju
hi write a while condition for 1 tsampler and untile expected results come
in response or five constant time for 60 secs after executing hte first one

please let me know

On Mon, Aug 19, 2019 at 4:32 PM pratik thorve <[hidden email]>
wrote:

> Adding 2 thread group will solve the problem but it will create issue when
> i need to report the results as we are considering 1 thread group as 1TC.
>
> On Mon, Aug 19, 2019 at 12:26 PM Niraj <[hidden email]> wrote:
>
> > How about adding two thread groups? API call within first thread group
> and
> > Message to JMS will be in other. Add Startup delay in the second thread
> > group. This should work i guess.
> >
> > On Mon, Aug 19, 2019 at 1:28 PM pratik thorve <[hidden email]>
> > wrote:
> >
> > > Hello All,
> > >
> > > I am stuck with the below problem and need help from the experts !
> > > I am using Jmeter for functional test purpose (Please dont curse me on
> > this
> > > :( )
> > > We have configured 1 thread group as 1 TC.
> > > So in my 1 thread i have all the steps that are related to 1 TC.
> > >
> > > Problem :
> > >
> > > First TC consists of 2 Call (Samplers) , API Call and JMS Point to
> Point
> > > message.
> > > Now the flow is :
> > > 1) Do the API call and wait for results (it works for 60 sec (running)
> > and
> > > then return the results)
> > > 2) Send the message to JMS (Active MQ)
> > >
> > > Now the API call will return a success message only when the second
> step
> > is
> > > executed.
> > > But since Jmeter executes the samplers one by one , my exeuction is
> stuck
> > > at first step.
> > > The second step is executed only when the first step (api call) is
> > > completed.
> > >
> > > I want to the run the first step (api call) , then trigger the seconds
> > step
> > > (while the first step is still under execution)
> > > So that the message from the seconds step can be processed by the
> > > application and get the result for the same in 1st step
> > >
> > > Tried and Not working :
> > > Used parallel executor and put both the samplers under the same , so
> that
> > > they are triggered together.
> > > Then added a delay to the seconds step.
> > > Looks like the delay does not work and both the request are sent at the
> > > same time.
> > >
> > > Please let me know if there is any way i can implement this.
> > >
> > >
> > > Pratik
> > >
> >
>
>
> --
> Regards ,
> Pratik Thorve
>
Reply | Threaded
Open this post in threaded view
|

Re: Handling Asynchronous API Call in Jmeter

glinius@live.com
In reply to this post by pratik thorve
You can consider putting your requests under  Parallel Controller
<https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md#parallel-controller>
, it executes its children at exactly the same moment hence you can overcome
JMeter's thread group limitation and spawn as many extra parallel threads as
needed to implement your scenario.

Check out  How to Use the Parallel Controller in JMeter
<https://www.blazemeter.com/blog/how-to-use-the-parallel-controller-in-jmeter/>  
article for more information on plugin usage.

You can install Parallel Sampler and Controller using  JMeter Plugins
Manager <https://jmeter-plugins.org/wiki/PluginsManager/>  



--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]