Stress Test API

I’m new to Scala and gatling so please bear with me. I have a bunch of different api tests inside one simulation:

`


class PerfTest extends Simulation {

        object Reference {
          val endpoints = exec(http("/search/reference/stuff")
            .get("/search/reference/stuff"))
            .exec(http("/search/reference/stuff?{zipcode}")
              .get("/search/reference/stuff?zipcode=30049"))
            .exec(http("/search/reference/zips/id/{zipcode}")
              .get("/search/reference/zips/id/30049"))
            .exec(http("/search/reference/years")
              .get("/search/reference/years"))
        }

        val httpConf = http
          .baseURL(http://blah.com)
          .contentTypeHeader("application/json")

        val scn = scenario("My Perf Tests")
          .exec(Reference.endpoints)
        setUp(scn.inject(atOnceUsers(100)).protocols(httpConf))
          .assertions(forAll.responseTime.mean.lessThan(800),
            forAll.successfulRequests.percent.is(100))

}

`

What I would like to do is repeat the above tests over and over, 1 user at a time, and see at what point (how many concurrent users) my assertions start to fail. I’d like to know a few things:

  1. At what concurrent user count do my tests start failing?

  2. Which endpoints are failing at those concurrent user counts?

  3. Is this the right way to set up the tests to get the information that I want?

I think that test will provide you the information you want. I would make one tweak though.
Change atOnceUsers(100)
to something more like this:
rampUsers(200) over (400 seconds)

You’ll want to change “over (400 seconds)” to whatever makes sense in your scenario.

Give it a run! You’ll probably have to visually inspect the report graphs to find out at what user count you begin seeing errors.

I should read the whole post… To run against one URL at a time, you could just comment out the other
“exec(http(”…").get("…"))"