Skip to content

Instantly share code, notes, and snippets.

@kinnou02
Created October 12, 2018 07:37
Show Gist options
  • Save kinnou02/c5b79052155051429db8c3dd5cc34520 to your computer and use it in GitHub Desktop.
Save kinnou02/c5b79052155051429db8c3dd5cc34520 to your computer and use it in GitHub Desktop.
package bragi
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class Bragi extends Simulation {
val httpConf = http
.baseURL("http://localhost:4000") // Here is the root for all relative URLs
.acceptEncodingHeader("gzip, deflate")
val requests = tsv("places.csv").random
val scn = scenario("coverage few call")
.feed(requests)
.exec(http("query")
.get("/autocomplete")
.queryParam("q", "${q}")
.check(status.is(200))
)
setUp(scn.inject(constantUsersPerSec(8) during(600) randomized).protocols(httpConf))
}
object Autocomplete {
val feeder = tsv("places.csv").random
val queries = exec().feed(feeder).exec(
http("autocomplete")
.get("/autocomplete")
.queryParam("q", "${q}")
.check(status.is(200)))
}
object Reverse {
val feeder = csv("coords.csv").random
val queries = exec().feed(feeder).exec(
http("reverse")
.get("/reverse")
.queryParam("lat", "${lat}")
.queryParam("lon", "${lon}")
.queryParam("pt_dataset", "${coverage}")
.check(status.is(200)))
}
class ReverseScn extends Simulation {
val httpConf = http
.baseURL("http://localhost:4000") // Here is the root for all relative URLs
.acceptEncodingHeader("gzip, deflate")
setUp(scenario("reverse").exec(Reverse.queries).inject(
constantUsersPerSec(60) during (300) randomized
).protocols(httpConf))
}
class geocodingScn extends Simulation {
val httpConf = http
.baseURL("http://localhost:4000") // Here is the root for all relative URLs
.acceptEncodingHeader("gzip, deflate")
setUp(scenario("geocoding").exec(Autocomplete.queries).inject(
constantUsersPerSec(20) during (300) randomized
).protocols(httpConf))
}
class Mixed extends Simulation {
val httpConf = http
.baseURL("http://mut-prd-bragi1.canaltp.prod") // Here is the root for all relative URLs
.acceptEncodingHeader("gzip, deflate")
val reverse = scenario("reverse").exec(Reverse.queries)
val autocomp = scenario("autocompletion").exec(Autocomplete.queries)
setUp(
autocomp.inject(constantUsersPerSec(3) during (600) randomized),
reverse.inject(constantUsersPerSec(30) during (600) randomized)
).protocols(httpConf)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment