Controlling requests per second and timeout threshold in Gatling

PhillipAMann picture PhillipAMann · Jan 22, 2015 · Viewed 7.7k times · Source

I am working on a Gatling simulation. For the life of me, I cannot get my code to reach 10000 requests per second. I have read the documentation and I keep messing with different methods and whatnot but my requests per second seems capped at 5000 requests per second. I have attached my current iteration of my code. The URL and path information is blurred out. Assume that I have no issue with the HTTP part of my simulation.

package computerdatabase

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
//import assertions._

class userSimulation extends Simulation {

  object Query {
    val feeder = csv("firstfileSHUF.txt").random
    val query = repeat(2000) {
                feed(feeder).
                exec(http("user")
                .get("/path/path/" + "${userID}" + "?fullData=true"))
    }
  }

  val baseUrl = "http:URL:7777"

  val httpConf = http
    .baseURL(baseUrl) // Here is the root for all relative URLs

  val scn = scenario("user") // A scenario is a chain of requests and pauses
    .exec(Query.query)

   setUp(scn.inject(rampUsers(1500) over (60 seconds)))
        .throttle(reachRps(10000) in (2 minute),
                  holdFor(3 minutes))
        .protocols(httpConf)

}

Additionally, I would like to set the maximum threshold for a timeout to be 100ms. I have tried to do this with assertions and also editing the configuration files but it never seems to show up during the tests or in my reports. How can I set a request to KO if the request took longer than 100ms? Thank you for your help with this matter!

Answer

PhillipAMann picture PhillipAMann · Mar 25, 2015

I ended up figuring this out. My code above is correct and I know understand what Stephane, one of the main contributors to Gatling was explaining. The server at the time simply could not handle my RPS threshold. It was an upper bound that was unreachable. After making changes to the server, we could handle this sort of latency. Additionally, I found a way to timeout at 100ms in the configuration file. Specifically, requestTimeout = 100 will cause the timeout behavior I was looking for.