Requests per Second is constant, but it shouldn't...

…or so I believe.
We created a scenario for load testing our web site.
The load pattern consists of some initial requests (navigating to the site, logging in) that will happen only once per user. After that, each user will start a loop where they search, manipulate some data, and start the loop again.

My scenario is designed in such a way that it adds 100 users every 10 minutes. With this in mind, it is logical that with more users, the requests per second will increase, since each user performs a loop.
But then the graphic looks like this:

Which shows roughly a constant value for requests per second. As you can see, even though we increased from 100 to 400 users, the requests per second remain around 40.
So in order to verify that we didn’t do anything wrong I created a much simpler scenario:

package simpleScenario

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

class SimpleSimulation extends Simulation {

val httpProtocol = http
.baseUrl(“http://sometesturl”)
.inferHtmlResources(BlackList(), WhiteList())
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.9”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”)
.enableHttp2
.maxConnectionsPerHost(20)
.shareConnections

val headers_0 = Map(
“Pragma” → “no-cache”,
“Proxy-Connection” → “keep-alive”)

val testLocal = exec(http(“request_0”)
.get("/")
.headers(headers_0)
.resources(http(“request_1”)
.get("/")
.headers(headers_0)))

val testLocalLoop = forever () {
exec(testLocal)
}

val scn = scenario(“SimpleScenario”).exec(testLocalLoop)

setUp(scn.inject(
incrementConcurrentUsers(50)
.times(6)
.eachLevelLasting(20 seconds)
.separatedByRampsLasting(10 seconds)))
.protocols(httpProtocol)
.maxDuration(5 minute)
}

The injection pattern is the same as with the “real” scenario. And this is the result after running:

And yes, still, a constant amount of requests per second.

Is this somehow an expected behavior? Is something wrong with my code? Are the requests per second represeting a value per user(that could explain the constant value)? Because if the requests per second remain constant while we are increasing users, well, my test seems completely invalid.

You’re most likely quickly saturating your website and hitting the limit of the number of requests requests per second it can process (of course, this number depends on the request type).