Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter Asynchronous API calls

Tags:

jmeter

The mobile app that I am testing with Jmeter makes 4 asynchronous API calls when logging in. Is there any way to simulate this with JMeter ?

Currently I can only get JMeter to make the calls synchronously, so when wrapping them all in the same transaction controller, the response time is the total of the 4 calls (instead of the highest one)

Many thanks

like image 538
JamesWillett Avatar asked Mar 14 '23 12:03

JamesWillett


2 Answers

Currently JMeter doesn't offer a relevant test element, the easiest way of implementing your scenario is using JSR223 Sampler to perform nested asynchronous calls, something like:

Groovy Ajax

See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for more detailed explanation, code snippets,etc.

You can also consider developing a custom sampler with similar functionality and make it a part of your JMeter as a plugin or even share it with the community.

like image 145
Dmitri T Avatar answered Apr 27 '23 02:04

Dmitri T


Take a look at Parallel Controller in JMeter.

All elements inside the Parallel Controller will be executed parallel to each other. This way, you will have one main flow and other flows with asynchronous requests, which will be executed in a parallel way.

https://www.blazemeter.com/blog/how-to-load-test-async-requests-with-jmeter

like image 23
Alejandro Trujillo Avatar answered Apr 27 '23 03:04

Alejandro Trujillo