Throttling based on error rates

I’m looking into Gatling, and am attempting to integrate feedback into the throttling mechanism, in particular I’d like to stop a throughput ramp based on error rates. I know this has been talked about before, but the latest post on the matter I can find is from 9/2015, so I figured it’s fair game to ask again.

I’m not sure how this would be properly implemented, but as an initial pass I was hoping to dynamically update the throttle’s rps as errors come in. As a simple definition, let’s say that any time a scenario’s status is KO, the maximum rps would be set to the current rps. In pseudo-gatling, I was going to try and do something like:

class BasicSimulation extends Simulation {
val httpConf = http.baseURL(“http://computer-database.gatling.io”)

val throttleStep = reachRps(1000) in (10 minutes)

val scn = scenario(“BasicSimulation”)
.exec(http(“request_1”)
.get(“/”)
.check(status).in(200 to 399))
.exec(session => {
if (session.status != OK) {
val newCap = somehowComputeCurrentRps()
throttleStep.target = newCap
}
})

setUp(
scn.inject(atOnceUsers(1000))
)
.throttle(throttleStep)
.protocols(httpConf)
}

Meaning, I inject a throttle into the simulation, and I’d dynamically adjust its target as I hit errors. In practice I’d want this logic to be more complicated, but I haven’t figured out exactly what I’d want to do (it’ll depend on what I can do). It’ll probably involve something like checking general error rates and if they’re out of spec go backwards in time until they go back in.

I have a feeling I could get this to work if I defined my own ThrottleStep implementation, but since ThrottleStep is a sealed trait, that’d require me to build my own custom version of Gatling, which I’d like to avoid doing. I’m also completely fine with it not being a generally applicable solution, since I can imagine this getting quite complicated when trying to handle a complicated throttle chain.

Any pointers on how one could hack this into a simulation? I’m not really looking for a solution that involves me manually watching graphs/log files to look for errors. Nor am I looking for a solution that completely aborts the Gatling run.

Thanks!

Based on the lack of response I’m assuming this isn’t really possible with Gatling and I should hack something together with my own Gatling fork, likely by creating a mutable throttle step class. If anyone has pointers on how this could be implemented please do let me know.

Thanks again