Hi,
If you see the screenshot, We are getting a sudden spike in QPS at the end of the test and in the other screenshot, you see we are getting the expected slowdown in qps, why is this wierd behaviour for same code base?
below is the code, Please help :
def resolveInjection(step: JSONObject): OpenInjectionStep = {
var stepType = step.getString(“type”)
var stepArgs = step.getJSONArray(“args”)
stepType match {
case “rampUsers” => rampUsers(Props.byNode(stepArgs.getInt(0))) during(stepArgs.getInt(1) seconds)
case “heavisideUsers” => heavisideUsers(Props.byNode(stepArgs.getInt(0))) during(stepArgs.getInt(1) seconds)
case “atOnceUsers” => atOnceUsers(Props.byNode(stepArgs.getInt(0)))
case “constantUsersPerSec” => constantUsersPerSec(Props.byNode(stepArgs.getInt(0))) during(stepArgs.getInt(1) seconds)
case “rampUsersPerSec” => rampUsersPerSec(Props.byNode(stepArgs.getInt(0))) to(Props.byNode(stepArgs.getInt(1))) during(stepArgs.getInt(2) seconds)
case “nothingFor” => nothingFor(stepArgs.getInt(0) seconds)
//Removing SpliUsers cases as it has been deprecated Gatling 3.0
}
}
def resolveThrottle(step: JSONObject): ThrottleStep = {
var stepType = step.getString(“type”)
var stepArgs = step.getJSONArray(“args”)
stepType match {
case “reachRps” => reachRps(Props.byNode(stepArgs.getInt(0))) in (stepArgs.getInt(1) seconds)
case “jumpToRps” => jumpToRps(Props.byNode(stepArgs.getInt(0)))
case “holdFor” => holdFor(stepArgs.getInt(0))
}
}
def printException(e: Exception) = {
val sw = new StringWriter()
e.printStackTrace(new PrintWriter(sw))
println(sw.toString)
}
def scnList() : Seq[PopulationBuilder] = {
var testList: JSONArray = null
try {
val rawTestList: String = Source.fromFile(Props.testcase).getLines.mkString
testList = new JSONArray(rawTestList)
} catch {
case fe: FileNotFoundException =>
println(“Could not find a valid Test Case to execute.”)
printException(fe)
System.exit(1)
case e: Exception =>
printException(e)
}
var scnCount :Int = testList.length()
var scnList = new ArraySeqPopulationBuilder
for (i ← 0 until scnCount) {
var testCase = testList.getJSONObject(i)
println("Scenario: " + testCase.getString(“api”))
var injectStepList: ArraySeq[OpenInjectionStep] = null
try {
var rampU :Int = testCase.getInt(“rampUsers”)
var rampT :Int = testCase.getInt(“rampTime”)
injectStepList = new ArraySeqOpenInjectionStep
injectStepList(0) = rampUsers(Props.byNode(rampU)) during (rampT seconds)
} catch {
case e: JSONException =>
val injectionSteps = testCase.getJSONArray(“inject”)
injectStepList = new ArraySeqOpenInjectionStep
for (j ← 0 until injectionSteps.length()) {
var step = injectionSteps.getJSONObject(j)
injectStepList(j) = resolveInjection(step)
}
}
var throttlingStepList: ArraySeq[ThrottleStep] = null
try {
var qps :Int = testCase.getInt(“qps”)
var rampT :Int = testCase.getInt(“rampTime”)
throttlingStepList = new ArraySeqThrottleStep
throttlingStepList(0) = reachRps(Props.byNode(qps)) in (rampT seconds)
throttlingStepList(1) = holdFor(Props.duration seconds)
} catch {
case e: JSONException =>
val throttlingSteps = testCase.getJSONArray(“throttle”)
throttlingStepList = new ArraySeqThrottleStep
for (k ← 0 until throttlingSteps.length()) {
var step = throttlingSteps.getJSONObject(k)
throttlingStepList(k) = resolveThrottle(step)
}
}
//scnList(i) = Scn.scenarioNames(testCase.getString(“api”)).inject(injectStepList: _*)
scnList(i) = Scn.scenarioNames(testCase.getString(“api”)).inject(injectStepList).throttle(throttlingStepList)
}
scnList
}
setUp(scnList:_*).protocols(Props.httpConf)
}