Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Performance & Stability testing \w Gatling

Performance & Stability testing \w Gatling

Dmitrijs Vrublevskis

April 09, 2015
Tweet

More Decks by Dmitrijs Vrublevskis

Other Decks in Programming

Transcript

  1. So? - Default API is too slow - Implement custom

    extension - Control all the things
  2. package com.neueda.example
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import scala.concurrent.duration._
 


    class Example extends Simulation {
 val httpConf = http.baseURL("http://www.example.com")
 
 val example = scenario("Example")
 .exec(
 http("get_example_index")
 .get("/")
 .check(status.is(200))
 )
 
 setUp(
 example.inject(rampUsers(10) over (10 seconds))
 ).protocols(httpConf)
 }
  3. package com.neueda.example
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import scala.concurrent.duration._
 


    class Example extends Simulation {
 val httpConf = http.baseURL("http://www.example.com")
 
 val example = scenario("Example")
 .exec(
 http("get_example_index")
 .get("/")
 .check(status.is(200))
 )
 
 setUp(
 example.inject(rampUsers(10) over (10 seconds))
 ).protocols(httpConf)
 }
  4. ================================================================================ 2015-04-07 23:02:54 5s elapsed ---- Example ------------------------------------------------------------------- [##################################### ]

    50% waiting: 5 / running: 0 / done:5 ---- Requests ------------------------------------------------------------------ > Global (OK=5 KO=0 ) > get_example_index (OK=5 KO=0 ) ================================================================================ ================================================================================ ---- Global Information -------------------------------------------------------- > request count 10 (OK=10 KO=0 ) > min response time 255 (OK=255 KO=- ) > max response time 302 (OK=302 KO=- ) > mean response time 274 (OK=274 KO=- ) > std deviation 13 (OK=13 KO=- ) > response time 95th percentile 293 (OK=293 KO=- ) > response time 99th percentile 300 (OK=300 KO=- ) > mean requests/sec 1.08 (OK=1.08 KO=- ) ---- Response Time Distribution ------------------------------------------------ > t < 800 ms 10 (100%) > 800 ms < t < 1200 ms 0 ( 0%) > t > 1200 ms 0 ( 0%) > failed 0 ( 0%) ================================================================================
  5. ================================================================================ 2015-04-07 23:02:54 5s elapsed ---- Example ------------------------------------------------------------------- [##################################### ]

    50% waiting: 5 / running: 0 / done:5 ---- Requests ------------------------------------------------------------------ > Global (OK=5 KO=0 ) > get_example_index (OK=5 KO=0 ) ================================================================================ ================================================================================ ---- Global Information -------------------------------------------------------- > request count 10 (OK=10 KO=0 ) > min response time 255 (OK=255 KO=- ) > max response time 302 (OK=302 KO=- ) > mean response time 274 (OK=274 KO=- ) > std deviation 13 (OK=13 KO=- ) > response time 95th percentile 293 (OK=293 KO=- ) > response time 99th percentile 300 (OK=300 KO=- ) > mean requests/sec 1.08 (OK=1.08 KO=- ) ---- Response Time Distribution ------------------------------------------------ > t < 800 ms 10 (100%) > 800 ms < t < 1200 ms 0 ( 0%) > t > 1200 ms 0 ( 0%) > failed 0 ( 0%) ================================================================================
  6. class Test extends Simulation {
 val httpConf = http.baseURL("http://neo-database:7474")
 


    val test = scenario("GetGraph")
 .exec(
 http("execute_query")
 .post("/extension/query/execute")
 .body(StringBody("MATCH (root)-[:HAS*]->(child)"))
 .check(status.is(200))
 .check(jsonPath("$.results").count.is(100))
 )
 
 setUp(
 test.inject(
 rampUsersPerSec(0) to (1000) during (60 seconds)
 )
 ).protocols(httpConf)
 }
  7. Learned - Performance testing should be done - Test results

    should be interpreted properly - Test results should be verified in different environments
  8. val feeder = Array(
 Map("query" -> "..."),
 Map("query" -> "..."),


    Map("query" -> "...")
 ) .queue .random .circular
  9. test.inject(
 nothingFor(5 seconds), atOnceUsers(10),
 rampUsersPerSec(10) to (100) during (20 seconds),


    constantUsersPerSec(100) during (40 seconds),
 rampUsersPerSec(100) to (500) during (20 second),
 constantUsersPerSec(100) during (60 seconds)
 )
  10. - Any IDE with Scala support is OK - Intellij

    IDEA - Eclipse (Scala IDE) - Netbeans
  11. - Generate background load - Make stability tests - Cluster

    communications - Load balancer setup - Spikes Load generator