You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/10/21 19:40:54 UTC

[54/58] [abbrv] git commit: updated load tests

updated load tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a8ab06c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a8ab06c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a8ab06c3

Branch: refs/heads/loadtest
Commit: a8ab06c33566779cad29c4d30f196b474f7f384d
Parents: 215186c
Author: amuramoto <am...@apigee.com>
Authored: Fri Oct 10 11:25:34 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Fri Oct 10 11:25:34 2014 -0700

----------------------------------------------------------------------
 stack/loadtests/loadtest_setup.sh               |  2 +-
 .../usergrid/scenarios/DeviceScenarios.scala    |  8 +++
 .../scenarios/NotificationScenarios.scala       |  5 ++
 .../usergrid/scenarios/UserScenarios.scala      | 12 ++++-
 .../simulations/GrindrPushSimulation.scala      | 52 ++++++++++++++++++++
 5 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8ab06c3/stack/loadtests/loadtest_setup.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/loadtest_setup.sh b/stack/loadtests/loadtest_setup.sh
index de79503..545244b 100644
--- a/stack/loadtests/loadtest_setup.sh
+++ b/stack/loadtests/loadtest_setup.sh
@@ -2,7 +2,7 @@
 check=`grep "DnumUsers" gatling/bin/gatling.sh`
 if [[ $check == "" ]]
 then 
-sed -i.bak 's/JAVA_OPTS="/JAVA_OPTS="-DnumUsers=${GATLING_NUMUSERS} -DrampTime=${GATLING_RAMPTIME} -Dduration=${GATLING_DURATION} -DnumEntities=${GATLING_NUMENTITIES} -Dbaseurl=${GATLING_BASE_URL} -Dorg=${GATLING_ORG} -Dapp=${GATLING_APP} -Dnotifier=${GATLING_NOTIFIER} -Dprovider=${GATLING_PPROVIDER} /g' gatling/bin/gatling.sh
+sed -i.bak 's/JAVA_OPTS="/JAVA_OPTS="-Dthrottle=${GATLING_THROTTLE} -DnumUsers=${GATLING_NUMUSERS} -DrampTime=${GATLING_RAMPTIME} -Dduration=${GATLING_DURATION} -DnumEntities=${GATLING_NUMENTITIES} -Dbaseurl=${GATLING_BASE_URL} -Dorg=${GATLING_ORG} -Dapp=${GATLING_APP} -Dnotifier=${GATLING_NOTIFIER} -Dprovider=${GATLING_PROVIDER} /g' gatling/bin/gatling.sh
 fi
 GATLING_NUMUSERS=5000
 GATLING_RAMPTIME=300

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8ab06c3/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
index 207939b..2ea2750 100755
--- a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
@@ -32,6 +32,14 @@ object DeviceScenarios {
       "\"${notifier}.notifier.id\":\"${entityName}\"}"))
     .check(status.is(200)))
 
+  val postDeviceWithNotifier400ok = exec(http("Create device with notifier")
+    .post("/devices")
+    .body(StringBody("{\"name\":\"${entityName}\"," +
+    "\"deviceModel\":\"Fake Device\"," +
+    " \"deviceOSVerion\":\"Negative Version\", " +
+    "\"${notifier}.notifier.id\":\"${entityName}\"}"))
+    .check(status.in(200 to 400)))
+
   /**
    * TODO: Add a device to a user, which would expect a user in the session
    */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8ab06c3/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
index 4c46b26..faec038 100755
--- a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
@@ -39,6 +39,11 @@ object NotificationScenarios {
       .check(status.is(200))
     )
 
+  val sendNotificationToUser= exec(http("Send Notification to All Devices")
+    .post("/users/${user}/notifications")
+    .body(StringBody("{\"payloads\":{\"${notifier}\":\"testmessage\"}}"))
+    .check(status.is(200))
+  )
 
   /**
    * TODO: Add posting to users, which would expect a user in the session

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8ab06c3/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/UserScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/UserScenarios.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/UserScenarios.scala
index 37e0003..4de65a7 100755
--- a/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/UserScenarios.scala
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/scenarios/UserScenarios.scala
@@ -7,7 +7,7 @@ object UserScenarios {
 
   val getRandomUser = exec(
     http("GET user")
-      .get("/users/user" + Utils.generateRandomInt(1, Settings.numUsers))
+      .get("/users/user" + Utils.generateRandomInt(1, Settings.numEntities))
       .check(status.is(200))
   )
 
@@ -21,4 +21,14 @@ object UserScenarios {
       .check(status.is(200))
   )
 
+  val postUser400ok = exec(
+    http("POST geolocated Users")
+      .post("/users")
+      .body(StringBody("{\"location\":{\"latitude\":\"${latitude}\",\"longitude\":\"${longitude}\"},\"username\":\"${username}\"," +
+      "\"displayName\":\"${displayName}\",\"age\":\"${age}\",\"seen\":\"${seen}\",\"weight\":\"${weight}\"," +
+      "\"height\":\"${height}\",\"aboutMe\":\"${aboutMe}\",\"profileId\":\"${profileId}\",\"headline\":\"${headline}\"," +
+      "\"showAge\":\"${showAge}\",\"relationshipStatus\":\"${relationshipStatus}\",\"ethnicity\":\"${ethnicity}\",\"password\":\"password\"}"))
+      .check(status.in(200 to 400))
+  )
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8ab06c3/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/GrindrPushSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/GrindrPushSimulation.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/GrindrPushSimulation.scala
new file mode 100644
index 0000000..a91b7ce
--- /dev/null
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/GrindrPushSimulation.scala
@@ -0,0 +1,52 @@
+package org.apache.usergrid
+
+import io.gatling.core.Predef._
+import io.gatling.http.Predef._
+import scala.concurrent.duration._
+
+class GrindrPushNotificationSimulation extends Simulation {
+
+  val numUsers:Int = Settings.numUsers
+  val numEntities:Int = Settings.numEntities
+  val rampTime:Int = Settings.rampTime
+  val throttle:Int = Settings.throttle
+  val duration:Int = Settings.duration
+  val httpConf = Settings.httpConf
+    .acceptHeader("application/json")
+
+  val notifier = Settings.pushNotifier
+  val createDevice = DeviceScenarios.postDeviceWithNotifier400ok
+  val sendNotification = NotificationScenarios.sendNotification
+  val createUser = UserScenarios.postUser400ok
+  val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities).circular
+  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numEntities, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+
+  val scnToRun = scenario("Create Push Notification")
+    .feed(userFeeder)
+    .exec(createUser)
+    .pause(1000)
+    .exec(http("Check user and user devices")
+      .get("/users/${username}/devices")
+      .check(status.is(200))
+    )
+    .feed(deviceNameFeeder)
+    .exec(createDevice)
+    .pause(1000)
+    .exec(http("Check device connections")
+      .get("/devices/${entityName}/users")
+      .check(status.is(200))
+    )
+    .exec(http("Connect user with device")
+      .post("/users/${username}/devices/${entityName}")
+      .check(status.is(200))
+    )
+    .exec(http("Send Notification to All Devices")
+      .post("/users/${username}/notifications")
+      .body(StringBody("{\"payloads\":{\"" + notifier + "\":\"testmessage\"}}"))
+      .check(status.is(200))
+    )
+
+
+  setUp(scnToRun.inject(constantUsersPerSec(numUsers) during (duration)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
+
+}