Skip to content

Instantly share code, notes, and snippets.

@maxdemarzi
Created March 9, 2015 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxdemarzi/c92d42c065171e067b67 to your computer and use it in GitHub Desktop.
Save maxdemarzi/c92d42c065171e067b67 to your computer and use it in GitHub Desktop.
Peak Transactions is 64 on my MBP
import io.gatling.core.Predef._
import io.gatling.core.scenario.Simulation
import io.gatling.http.Predef._
import scala.concurrent.duration._
class CreateNode extends Simulation {
val httpConf = http
.baseURL("http://localhost:7474")
.acceptHeader("application/json")
/* Uncomment to see the response of each request.
.extraInfoExtractor(extraInfo => {
println(extraInfo.response.body.string)
Nil
}).disableResponseChunksDiscarding
*/
// Use a data file for our requests and repeat values if we get to the end.
val feeder = csv("usernames.csv").circular
val query = """CREATE (me:User {username:{username}})"""
val cypherQuery = """{"statements" : [{"statement" : "%s", "parameters" : { "username": "${username}" }}]}""".format(query)
val scn = scenario("Get Friends")
.repeat(100) {
feed(feeder)
.exec(
http("get friends")
.post("/db/data/transaction/commit")
.body(StringBody(cypherQuery))
.asJSON
.check(status.is(200))
)
}
setUp(
scn.inject(rampUsers(100) over(10 seconds)).protocols(httpConf)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment