usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: updating docs, adding skip setup
Date Thu, 06 Nov 2014 21:21:19 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o c86d54118 -> 81f56f6a9


updating docs, adding skip setup


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

Branch: refs/heads/two-dot-o
Commit: 81f56f6a984ed1e0ec2e8aa8eef8ed4cf8fc90be
Parents: c86d541
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Nov 6 14:20:58 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Nov 6 14:20:58 2014 -0700

----------------------------------------------------------------------
 stack/loadtests/README.md                       | 10 ++--
 .../org/apache/usergrid/helpers/Setup.scala     |  2 +-
 .../scenarios/ConnectionScenarios.scala         | 21 +++++++-
 .../scenarios/NotificationScenarios.scala       |  3 +-
 .../org/apache/usergrid/settings/Settings.scala |  5 ++
 .../usergrid/simulations/AppSimulation.scala    | 17 ++++---
 .../simulations/ConnectionsSimulation.scala     | 53 ++++++++++++++++++++
 .../simulations/GeoProfileSimulation.scala      | 33 ------------
 .../simulations/PostDevicesSimulation.scala     | 45 -----------------
 9 files changed, 96 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/README.md
----------------------------------------------------------------------
diff --git a/stack/loadtests/README.md b/stack/loadtests/README.md
index b246d04..a17813e 100644
--- a/stack/loadtests/README.md
+++ b/stack/loadtests/README.md
@@ -10,13 +10,17 @@ Gatling will run through mvn
 
 	*Addional optional settings 
 		
-	>-DpushNotifier={notifierName} -DpushProvider={noop_apns_or_gcm} 
+	>-DpushNotifier={notifierName} -DpushProvider={noop_apns_or_gcm} -DskipSetup={boolean}
+
+	skipSetup will skip the setup steps
 
 	So running will look something like this
 	>mvn gatling:execute -Dthrottle=100 -Dduration=300 -Dorg=usergrid  -Dapp=load -Dbaseurl=http://load.usergrid.com
-DnumEntities=300 -DnumUsers=600 -DrampTime=30 -DadminUser=usergrid -DadminPassword=test -Dgatling.simulationClass=org.apache.usergrid.simulations.AppSimulation
 	
-	Setting the rampTime => Injects a given number of users with a linear ramp over a given
duration.
-
+	Setting the users and duration => Injects a given number of users with a linear ramp
over a given duration. users must be greater than duration
+	
+	Setting the throttle and ramptime => will attempt to hit a set reqs/sec over a given
time period.  If users and duration are not great enough then you will never hit your throttle
+	
 	Values for simulation are 'all','connections'
 	
 	Also see http://gatling.io/docs/2.0.2/general/simulation_setup.html

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
index 96ce1c9..3a3a9c5 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
@@ -105,7 +105,7 @@ object Setup {
   }
 
   def setupUsers() = {
-    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers
, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    val userFeeder = Settings.userFeeder
     val numUsers = userFeeder.length
     println(s"setupUsers: Sending requests for $numUsers users")
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
index 8037ade..e56124d 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
@@ -18,11 +18,12 @@
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
- import org.apache.usergrid.settings.Headers
+ import org.apache.usergrid.datagenerators.FeederGenerator
+ import org.apache.usergrid.settings.{Settings, Headers}
 
  object ConnectionScenarios {
 
-  val postConnection = exec(
+  val postUserConnection = exec(
     http("POST connection")
     .post("/users/${user1}/likes/users/${user2}")
       .headers(Headers.jsonAuthorized)
@@ -36,5 +37,21 @@ import io.gatling.http.Predef._
       .headers(Headers.jsonAuthorized)
       .check(status.is(200))
   )
+   val entityNameFeeder = FeederGenerator.generateEntityNameFeeder("device", Settings.numEntities)
+   val createScenario = scenario("Create Connections")
+     .feed(Settings.userFeeder)
+     .exec(TokenScenarios.getUserToken)
+     .exec( UserScenarios.getUserByUsername)
+     .repeat(2){
+       feed(entityNameFeeder)
+         .exec( DeviceScenarios.postDeviceWithNotifier)
+         .exec(ConnectionScenarios.postUserToDeviceConnection)
+     }
+     .exec(session => {
+     // print the Session for debugging, don't do that on real Simulations
+     println(session)
+     session
+   })
+     .exec( )
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
index b248260..a96cb61 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
@@ -68,10 +68,9 @@ object NotificationScenarios {
   )
 
   val numEntities:Int = Settings.numUsers * 3 * Settings.duration
-  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers, Settings.userLocationRadius,
Settings.centerLatitude, Settings.centerLongitude)
 
   val createScenario = scenario("Create Push Notification")
-    .feed(userFeeder)
+    .feed(Settings.userFeeder)
     .exec(TokenScenarios.getUserToken)
     .exec( UserScenarios.getUserByUsername)
     .repeat(2){

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
index 03a4200..b595c9d 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
@@ -32,6 +32,8 @@ object Settings {
   val baseAppUrl = baseUrl + "/" + org + "/" + app
   val httpConf = http.baseURL(baseAppUrl)
 
+  val skipSetup:Boolean = System.getProperty("skipSetup") == "true"
+
   // Simulation settings
   var numUsers:Int = Integer.getInteger("numUsers", 10).toInt
 
@@ -64,4 +66,7 @@ object Settings {
   val constantUsers:Int = Settings.numUsers/Settings.duration
   println(s"Will inject $constantUsers users per sec")
 
+  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsers, userLocationRadius,
centerLatitude, centerLongitude)
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
index 50a4728..fb2f8cf 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
@@ -33,13 +33,16 @@ import scala.concurrent.duration._
  */
 class AppSimulation extends Simulation {
 
-  println("Begin setup")
-  Setup.setupOrg()
-  Setup.setupApplication()
-  Setup.setupNotifier()
-  Setup.setupUsers()
-  println("End Setup")
-
+  if(!Settings.skipSetup) {
+    println("Begin setup")
+    Setup.setupOrg()
+    Setup.setupApplication()
+    Setup.setupNotifier()
+    Setup.setupUsers()
+    println("End Setup")
+  }else{
+    println("Skipping Setup")
+  }
   setUp(
     NotificationScenarios.createScenario
       .inject(constantUsersPerSec(Settings.constantUsers) during (Settings.duration)) //
wait for 15 seconds so create org can finish, need to figure out coordination

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConnectionsSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConnectionsSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConnectionsSimulation.scala
new file mode 100644
index 0000000..efc3c69
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConnectionsSimulation.scala
@@ -0,0 +1,53 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.simulations
+
+import io.gatling.core.Predef._
+import io.gatling.core.scenario.Simulation
+import org.apache.usergrid.helpers.Setup
+import org.apache.usergrid.scenarios.{ConnectionScenarios, NotificationScenarios}
+import org.apache.usergrid.settings.Settings
+import scala.concurrent.duration._
+
+/**
+ * Classy class class.
+ */
+class ConnectionsSimulation extends Simulation{
+
+  if(!Settings.skipSetup) {
+    println("Begin setup")
+    Setup.setupOrg()
+    Setup.setupApplication()
+    Setup.setupNotifier()
+    Setup.setupUsers()
+    println("End Setup")
+  }else{
+    println("Skipping Setup")
+  }
+
+  setUp(
+    ConnectionScenarios.createScenario
+      .inject(constantUsersPerSec(Settings.constantUsers) during (Settings.duration)) //
wait for 15 seconds so create org can finish, need to figure out coordination
+      .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
+      .protocols( Settings.httpConf.acceptHeader("application/json"))
+  )
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
deleted file mode 100644
index b8b8839..0000000
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  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.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.simulations
-
-import io.gatling.core.Predef._
-import io.gatling.http.Predef._
-import org.apache.usergrid.scenarios.{OrganizationScenarios, UserScenarios}
-import org.apache.usergrid.settings.Settings
-
-/**
- * Classy class class.
- */
-class GeoProfileSimulation extends Simulation {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/81f56f6a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostDevicesSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostDevicesSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostDevicesSimulation.scala
deleted file mode 100755
index d7c6dd8..0000000
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostDevicesSimulation.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 io.gatling.http.Predef._
- import org.apache.usergrid.datagenerators.FeederGenerator
- import org.apache.usergrid.scenarios.DeviceScenarios
- import org.apache.usergrid.settings.Settings
- import scala.concurrent.duration._
-
-class PostDevicesSimulation extends Simulation {
-
-  // Target settings
-  val httpConf = Settings.httpConf
-
-  // Simulation settings
-  val numUsers:Int = Settings.numUsers
-  val numEntities:Int = Settings.numEntities
-  val rampTime:Int = Settings.rampTime
-  val throttle:Int = Settings.throttle
-
-  val feeder = FeederGenerator.generateEntityNameFeeder("device", numEntities)
-
-  val scnToRun = scenario("POST device")
-    .feed(feeder)
-    .exec(DeviceScenarios.postDeviceWithNotifier)
-
-  setUp(scnToRun.inject(atOnceUsers(numUsers)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
-
-}


Mime
View raw message