Number of requests per second being submitted by Gating is much lower with updated json requests;

Hi,

We are running basically the same scenario with more updated json post requests; however, the number of requests per second being submitted by Gatling goes down by half.
The size of a typical file for Version A is 227K, and for more updated JSON’s, Version B, is 295K. I don’t think the file size could be a factor. But I am not sure.

The injection model using Version A JSON’s is 450 users over 500 secs.
The injection model using Version B JSON’s is 500 user over 20 secs, throttle 400

I guess my question is, why am I not seeing a graph for Version B very similar to Version A. Why is the second run submitting requests at much slower pace.

This is my code. It simulates a student going thru an exercise and submitting answers to questions, an event.

class dayN(name: String, eventCount: Int, dayOffset: Int) {
  private[this] def getOffsetNow: Instant = Instant.now().minus(dayOffset, ChronoUnit.DAYS)

  protected val submitEvents: ScenarioBuilder = scenario(name)
    .feed(trainingSessionIdFeeder)
    .feed(exerciseSessionIdFeeder)
    .exec(session => {
      // set session dates
      val offsetNow: Instant = getOffsetNow
      session
        // set day name
        .set("name", name)
        // set dates
        .set("trainingDate", offsetNow)
        .set("trainingSessionStarted", offsetNow)
        .set("exerciseSessionStarted", offsetNow)
    })
    // loop over all of the events 0 .. N-1
    .repeat(eventCount,"eventNum") {
    feed(idFeeder)
      //.pause(1)
      .exec(session => {
      // set event sequence
      val newSequenceId: Int = 1 + session.get("sequenceId").as[String].toInt
      // set event dates
      val offsetNow: Instant = getOffsetNow
      session
        // set sequence
        .set("sequenceId", newSequenceId.toString)
        // set dates
        .set("timeStamp", offsetNow)
        .set("unixTimestamp", getEpochSeconds(offsetNow))
        // should only set this for TSE
        .set("trainingSessionEnded", offsetNow)
        // should only set this for ESE
        .set("exerciseSessionEnded", offsetNow)
    })
      // POST the event
      .exec(http("Events ${name}")
      .post("/event")
      .header(HttpHeaderNames.Authorization, "${trainingAuth}")
      .header(HttpHeaderNames.ContentType, "application/json")
      .header(HttpHeaderNames.ContentEncoding, "gzip")
      .body(ElFileBody("/round4/LCBNE/${name}/${eventNum}.json")).asJSON
      .processRequestBody(gzipBody)
      .check(status.is(204))
    )
  }
}

object day1Session1 extends dayN("day1Session1", 89, 5) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day1Session2 extends dayN("day1Session2", 99, 5) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day2Session1 extends dayN("day2Session1", 127, 4) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day2Session2 extends dayN("day2Session2", 92, 4) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day3Session1 extends dayN("day3Session1", 97, 3) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day3Session2 extends dayN("day3Session2", 97, 3) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day4Session1 extends dayN("day4Session1", 102, 2) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day4Session2 extends dayN("day4Session2", 95, 2) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day5Session1 extends dayN("day5Session1", 110, 1) {
  val submit: ScenarioBuilder = this.submitEvents
}

object day5Session2 extends dayN("day5Session2", 103, 1) {
  val submit: ScenarioBuilder = this.submitEvents
}
object day5Session3 extends dayN("day5Session3", 113, 1) {
  val submit: ScenarioBuilder = this.submitEvents
}

val trainingScn: ScenarioBuilder = scenario("Train")
  .feed(learnerGenerator)
  .feed(tenantIdFeeder)
  .feed(orgIdFeeder)
  .feed(exerciseNameFeeder)
  .exec(session => {
    // set auth header data
    val trainingAuth = getAuth(session.get("learnerId").as[String])
    session.set("trainingAuth", trainingAuth)
  })
  .exitBlockOnFail {
    // day 1
    exec(trainingConfig.get)
      .exec(state.get)
      .exec(day1Session1.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day1Session2.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day2Session1.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day2Session2.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day3Session1.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day3Session2.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day4Session1.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day4Session2.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day5Session1.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day5Session2.submit)
      .exec(scorecard.get)

      .exec(trainingConfig.get)
      .exec(state.get)
      .exec(day5Session3.submit)
      .exec(scorecard.get)

  }

My2cents (I can only guess because you didn’t provide the response times comparison): the lowest throughput is caused by longer response times (as you use a repeat loop so events are sequential for a given virtual user).
What you’re seeing is the difference between querying the same data over and over again and load testing your caches instead querying different data and load testing your actual application. The former is usually doesn’t make any sense.

Hi Stephane,

I think I replied only to you. I am replying to the POST here. I hope you don’t mind, so that it might help someone else in the future?

I have included the Response time, for VersionA and VersionB (more updated JSON being produced by our application).

My main question is, if the response time is less for VersionB than for VersionA, why is Gatling submitting requests at a slower pace when I am using VersionB JSONs.

Thanks again,
Javier

I suspect you’re comparing apples and oranges.
A executes 353,500 requests while B executes 842,000 requests.
You most likely have different pauses and injection profiles.