Gauthier
Gauthier

Reputation: 3

How to call multiple APIs in parallel for load testing (using Gatling)?

I'm currently trying to load test my APIs using Gatling, but I have a very specific test that I want to perform. I would like to simulate a Virtual User calling all my APIs (the 16 of them) simultaneously. I would like to repeat this multiple times so I can have an idea of the average time it takes for my APIs to respond when called all together at the same time.

The method I used was :

The aim was to have 60 iterations of what I wanted.

FYI I'm using Gatling 3.1.2

//This is what all my scenarios look like

val bookmarkScn = scenario("Bookmarks").exec(http("Listing bookmarks")
                .get("/bookmarks")
                .check(status.is(200))
            )

//My setUp

setUp(
    bookmarkScn.inject(
        atOnceUsers(60)
    ).throttle(
        jumpToRps(1),
        holdFor(60)
    ),
    permissionScn.inject(
        atOnceUsers(60)
    ).throttle(
        jumpToRps(1),
        holdFor(60)
    ),

//Adding all the scenarios one after the other

).protocols(httpConfig)


I got some results with this method but they are not at all what I was expecting and if I keep the test going for too long eventually every call just timeout.

It was supposed to just take more time than usual (e.g from 100ms per API to 300ms).

My question is : Is this method correct ? Can you help me achieve my goal ?

Upvotes: 0

Views: 2426

Answers (1)

James Warr
James Warr

Reputation: 2604

What you've got should work, but there's probably an easier way to specify this injection. Instead of

bookmarkScn.inject(
    atOnceUsers(60)
).throttle(
    jumpToRps(1),
    holdFor(60)
),

you could use

bookmarkScn.inject(
    constantUsersPerSec(1) during (60 seconds)
),

in terms of your results, I'd expect that the issue lies somewhere downstream of gatling - 16 concurrent users making simple GET requests is very straightforward for Gatling. You may have issues elsewhere with performance in your app or infrastructure in-between.

Upvotes: 0

Related Questions