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/12/03 23:32:38 UTC

incubator-usergrid git commit: WIP, first copy of adding users simulation

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-252 7645a7910 -> bd79d37d5


WIP, first copy of adding users simulation


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

Branch: refs/heads/USERGRID-252
Commit: bd79d37d56c6f1458990c463833fcf7d39828728
Parents: 7645a79
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 3 15:32:34 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 3 15:32:34 2014 -0700

----------------------------------------------------------------------
 .../usergrid/scenarios/UserScenarios.scala      | 11 +++++
 .../simulations/GetUsersSimulation.scala        | 51 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd79d37d/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
index 7d1c9b5..2ca6d21 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
@@ -56,6 +56,15 @@ import io.gatling.core.Predef._
           )
 
 
+
+   val getUsersWithCursor = exec(
+     http("GET user")
+       .get("/users?cursor=${cursor}")
+       .headers(Headers.jsonAuthorized)
+       .check(status.saveAs("userStatus"),  jsonPath("$..entities").saveAs("users"))
+   )
+
+
    /**
      * Try to get a user, if it returns a 404, create the user
      */
@@ -109,4 +118,6 @@ import io.gatling.core.Predef._
    val postUsersInfinitely =  scenario("Post Users")
         .feed(Settings.getInfiniteUserFeeder())
         .exec(UserScenarios.postUser)
+
+   val getUsersIndefinitely = scenario("Get Users").exec()
  }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd79d37d/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GetUsersSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GetUsersSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GetUsersSimulation.scala
new file mode 100755
index 0000000..eefeff1
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GetUsersSimulation.scala
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.simulations
+
+import io.gatling.core.Predef._
+import org.apache.usergrid.helpers.Setup
+import org.apache.usergrid.scenarios.UserScenarios
+import org.apache.usergrid.settings.Settings
+
+/**
+ * Posts application users continually to an application.  Expects the following parameters
+ *
+ * -DmaxPossibleUsers : The maximum number of users to be making requests as fast as possible.  Think of this as conccurrent users in the system
+ * -DrampTime: The amount of time (in seconds) to allow for maxPossibleUsers to be reached.  This will add new users linearlly
+ * -Dduration: The amount of time (in seconds) to continue to perform requests up with the maxPossibleUsers
+ */
+class GetUsersSimulation extends Simulation {
+
+  println("Begin setup")
+  Setup.setupOrg()
+  Setup.setupApplication()
+  println("End Setup")
+
+
+  setUp(
+    UserScenarios.postUsersInfinitely
+      .inject(
+        /**
+         * injection steps take from this forum post
+         * https://groups.google.com/forum/#!topic/gatling/JfYHaWCbA-w
+         */
+        rampUsers(Settings.maxPossibleUsers) over Settings.rampTime,
+        constantUsersPerSec(Settings.maxPossibleUsers) during Settings.duration
+
+      )).protocols(Settings.httpConf.acceptHeader("application/json"))
+
+}