I have created a Spring Boot application and I am using the plugin gatling-maven-plugin version 4.3.7 and the dependency gatling-charts-highcharts version 3.9.5.
I have implemented a simulation by extending the Simulation class from the package io.gatling.javaapi.core.
I have a simple scenario where I make 2 requests to different endpoints of a REST API:
ScenarioBuilder testScenario = scenario("Testscenario")
.exec(http("GET endpoint1")
.get("/endpoint1")
.check(status().is(200)))
.exec(http("GET endpoint2")
.get("/endpoint1")
.check(status().is(200)));
The response time for both endpoints is roughly 50ms when making the http request from my machine. All tools I have used so far to verify that (Postman, Insomnia, ThunderClient for VS code) confirm the reponse time.
But in my gatling simulation I have the following problem:
I’m running the simulation by ramping up 100 virtual users over 1 minute. After running the simulation a report is generated from the gatling-charts-highcharts dependency. In the report I can see the response times for the two requests to endpoint1 and endpoint2, respectively. But whatever order I use, the first http requests always has a considerably higher response time. So if I call endpoint1 first and then endpoint2, then the average response time for the request to endpoint1 is rougly 1000 ms and the average response time for endpoint2 is about 50 ms.
Now if I change the order in the gatling simulation and send the http request to endpoint2 first, then the average response time for endpoint2 is 1000 ms and for endpoint1 the average response time is 50 ms.
But if I send only one request to one of these two endpoints, then I get an average response time of 50 ms, as it should be.
Does anyone know what could cause that problem and how to fix it?