Search code examples
load-testinggatlingstress-testing

Increase Gatling requests in load test via increase in users?


class myTest extends Simulation {
  val headers = Map("Authorization" -> "longAuthHeader")

  val httpProtocol = http
    .baseUrl("http://baseurl.com:8000")
    .headers(headers)

  val scn = scenario("Scenario Name")
    .exec(http("request")
    .get("/data/url/"))

   setUp(scn.inject(constantUsersPerSec(40) during (2 minutes)))
    .protocols(httpProtocol)
    .throttle(jumpToRps(40), holdFor(2 minutes))
}

Using the above, I am creating a test using gatling which performs 40 RPS to baseurl.com:8000/data/url and maintains this for 2 minutes.

The problem with above approach is that only one user (as identified by the auth header) is performing the test.

What steps do I need to take to change this test to perform a request with, say, 40 users (40 different auth headers) that perform 1RPS each? So I will have 40 RPS distributed over 40 users rather than 40 RPS from one user.

This is important because my application performs slightly different behaviour based on the user context (different auth headers = different behaviour).


Solution

  • The Gatling advanced tutorial describes how to do exactly this

    docs.gatling.io/tutorials/advanced/ You're interested the sections on configuring virtual users and feeders –