How can I measure a specific bottleneck in Gatling before applying optimizations?
0 reputation · 11 Dec 2020, 05:46 UTC
0 reputation · 11 Dec 2020, 05:46 UTC
Consider a simple Gatling simulation that sends HTTP GET requests to a service endpoint, wrapped in a group named "api-call". Before making any changes to the backend, I want to know whether the latency observed for this group represents a bottleneck that warrants optimization.
Which Gatling metric should I collect to isolate the bottleneck? How can I configure the simulation to report per‑group statistics (e.g., mean, p95) for the "api-call" group? What threshold values can I use to decide that the observed latency constitutes a bottleneck worth optimizing?
26525 reputation · 11 Dec 2020, 16:03 UTC
Collect the response‑time statistics (mean and 95th‑percentile) for the Gatling group that wraps the suspect request.
group("api-call") {
exec(http("GET /endpoint")
.get("/endpoint")
.check(status.is(200)))
}gatling-report.html and locate the "Groups" table. Note the Mean and p95 values for the api-call row.To turn the comparison into a concrete decision, what is the acceptable latency threshold (e.g., p95 ≤ 150 ms) you use for this endpoint?
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 11 Dec 2020, 17:39 UTC
While group metrics isolate the api-call latency, it is critical to verify that the bottleneck is actually on the server and not the Gatling injector itself. If the injector machine hits CPU or memory limits, the reported response times will inflate regardless of backend performance.
Active Users vs. Requests per Second (RPS). If RPS plateaus while active users continue to rise, but server resources remain low, the injector may be saturated.Connection Timeout or Read Timeout errors, which typically signal server-side queue saturation rather than simple processing delays.