I am testing stateless web services, and my goal is to have a “capacity” test that slowly ramps requests per second until the check for exec fails.
When the check fails, it would be ideal to have the simulation finish (no reason to continue to ramp up on the failed server).
Is that possible with Gatling?
I have a script that performs the needed simulation but lacks the short circuit if the check fails
val baseURL = System.getProperty(“baseURL”, “http://localhost:9091”)
val httpProtocol: HttpProtocolBuilder = http.baseURL(baseURL)
val requestHeaders = Map(
// additional headers
“Content-Type” → “application/json”
)
val scn = scenario(“Capacity Test for Service X”)
.exec(http(“POST to sync endpoint”)
.post("/v2.0/me/sync")
.body(ELFileBody(“Capacity.json”))
.headers(boilerplate)
.headers(requestHeaders)
.check(status.is(200), jsonPath("$…syncId").exists, responseTimeInMillis.lessThan(100))
)
setUp(scn.inject(
// TODO why does only during(1800) work and not during(60 seconds)
rampRate(1 usersPerSec) to (500 usersPerSec) during (1800)
)).protocols(httpProtocol)
I tried using exitHereIfFailed but as far as I can tell, that just exits the session, it does not exit the entire simulation, but I may be wrong about that. I tried it and it did not seem to have an effect
Something else I noticed is that if I use latencyInMillis.lessThan(100) in the check , it never fails that check. even if I do something like latencyInMillis.lessThan(1) when I know the latencies are in the 10’s of milliseconds.
Hope I’ve explained myself we’ll, and I’m not missing something obvious (I’m by no means a Scala expert)
I am testing stateless web services, and my goal is to have a "capacity"
test that slowly ramps requests per second until the check for exec fails.
When the check fails, it would be ideal to have the simulation finish (no
reason to continue to ramp up on the failed server).
Is that possible with Gatling?
There's already a feature request for what you ask:
It will only be implemented in 2.1.
The best I could come up with for now is to stop hammering the system, but
that wouldn't stop the simulation (it will still run all your planned
virtual users, even if they do nothing). Would that suffice for now?
Something else I noticed is that if I use latencyInMillis.lessThan(100)in the check , it never fails that check. even if I do something like
latencyInMillis.lessThan(1) when I know the latencies are in the 10's of
milliseconds.
Thanks Stéphane (sorry I didn’t spot the issue prior to posting). Also thank you on the latency fix.
" for now is to stop hammering the system" is certainly a great intermediate step prior to having the feature, but do you have any guidance on how that would look implementation wise?
Again, thanks for the help, your contributions here are quite amazing!
Is it possible to get access to the Requests Per Sec metric when the check failed. Something as simple as:
println("Check failed at " + failureRequestsPerSec)
I’m currently running this test with the maven plugin via the Jenkins plugin. If the request per second at check failure were output, it could be captured by Jenkins and included in the email Jenkins sends out.