You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/12/03 18:58:16 UTC

[01/16] incubator-usergrid git commit: [APIBAAS-1391]Adding cluster configuration for gatling cluster

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o de455c3c4 -> c2bc921db


[APIBAAS-1391]Adding cluster configuration for gatling cluster


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

Branch: refs/heads/two-dot-o
Commit: 3bc7a89a0d26b311b3dd584828d5b5adec0b6850
Parents: d70ca53
Author: ryan bridges <rb...@apigee.com>
Authored: Thu Nov 13 16:13:12 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Thu Nov 13 16:13:12 2014 -0500

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json | 359 ++++++++++++++++++++++++++
 1 file changed, 359 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3bc7a89a/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
new file mode 100644
index 0000000..16b8d5b
--- /dev/null
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -0,0 +1,359 @@
+{
+    "AWSTemplateFormatVersion" : "2010-09-09",
+    "Description" : "Gatling cluster",
+
+    "Parameters" : {
+        "InstanceCount": {
+            "Description" : "The number of gatling instances to create",
+            "Type": "Number",
+            "Default": "1",
+            "MinValue": "1"
+        },
+
+        "KeyName": {
+            "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
+            "Type": "AWS::EC2::KeyPair::KeyName",
+            "Default" : "jenkins-east",
+            "ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
+        },
+
+        "InstanceType" : {
+            "Description" : "WebServer EC2 instance type",
+            "Type" : "String",
+            "Default" : "m1.xlarge",
+            "AllowedValues" : [ "t1.micro", "t2.micro", "t2.small", "t2.medium", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "g2.2xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"]
+            ,
+            "ConstraintDescription" : "must be a valid EC2 instance type."
+        },
+
+        "OperatorEMail": {
+            "Description": "EMail address to notify if there are any scaling operations",
+            "Type": "String",
+            "AllowedPattern": "([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)",
+            "ConstraintDescription": "must be a valid email address.",
+            "Default":"rbridges@apigee.com"
+        },
+
+        "ReleaseBucket": {
+            "Description": "S3 Bucket where Usergrid assembly is to be found.",
+            "Type": "String",
+            "Default": "usergrid-jenkins-builds"
+        },
+
+        "SSHLocation" : {
+            "Description" : "The IP address range that can be used to SSH to the EC2 instances",
+            "Type": "String",
+            "MinLength": "9",
+            "MaxLength": "18",
+            "Default": "0.0.0.0/0",
+            "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
+            "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
+        }
+    },
+
+    "Mappings" : {
+        "AWSInstanceType2Arch": {
+            "t1.micro": {
+                "Arch": "64"
+            },
+            "m1.small": {
+                "Arch": "64"
+            },
+            "m1.medium": {
+                "Arch": "64"
+            },
+            "m1.large": {
+                "Arch": "64"
+            },
+            "m1.xlarge": {
+                "Arch": "64"
+            },
+            "m3.large": {
+                "Arch": "64"
+            },
+            "m3.xlarge": {
+                "Arch": "64"
+            },
+            "c3.large": {
+                "Arch": "64"
+            },
+            "c3.xlarge": {
+                "Arch": "64"
+            },
+            "c3.2xlarge": {
+                "Arch": "64"
+            },
+            "c3.4xlarge": {
+                "Arch": "64"
+            }
+        },
+        "AWSRegionArch2AMI": {
+            "ap-southeast-2": {
+                "64": "ami-c1335ffb"
+            },
+            "us-east-1": {
+                "64": "ami-c43491ac"
+            },
+            "us-west-2": {
+                "64": "ami-194a0429"
+            }
+        },
+        "TwoAZs": {
+            "ap-southeast-2": {
+                "AZ1": "ap-southeast-2a",
+                "AZ2": "ap-southeast-2b"
+            },
+            "us-east-1": {
+                "AZ1": "us-east-1b",
+                "AZ2": "us-east-1c"
+            },
+            "us-west-2": {
+                "AZ1": "us-west-2a",
+                "AZ2": "us-west-2b"
+            }
+        }
+
+
+    },
+
+    "Resources" : {
+        "NotificationTopic": {
+            "Type": "AWS::SNS::Topic",
+            "Properties": {
+                "Subscription": [ { "Endpoint": { "Ref": "OperatorEMail" }, "Protocol": "email" } ]
+            }
+        },
+        "GatlingServerGroup" : {
+            "Type" : "AWS::AutoScaling::AutoScalingGroup",
+            "CreationPolicy" : {
+                "ResourceSignal" : {
+                    "Timeout" : "PT15M",
+                    "Count"   : { "Ref" : "InstanceCount" }
+                }
+            },
+            "Properties" : {
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
+                "LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
+                "MinSize" : { "Ref" : "InstanceCount" },
+                "MaxSize" : "10",
+                "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ],
+                "NotificationConfiguration" : {
+                    "TopicARN" : { "Ref" : "NotificationTopic" },
+                    "NotificationTypes" : [ "autoscaling:EC2_INSTANCE_LAUNCH","autoscaling:EC2_INSTANCE_LAUNCH_ERROR","autoscaling:EC2_INSTANCE_TERMINATE", "autoscaling:EC2_INSTANCE_TERMINATE_ERROR"]
+                }
+            }
+        },
+
+        "LaunchConfig" : {
+            "Type" : "AWS::AutoScaling::LaunchConfiguration",
+            "Metadata" : {
+                "Comment" : "Install Gatling",
+                "AWS::CloudFormation::Init" : {
+                    "config" : {
+                        "files" : {
+                            "/etc/profile.d/aws-credentials.sh" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "export AWS_ACCESS_KEY=", { "Ref":"GatlingKey" }, "\n",
+                                    "export AWS_SECRET_KEY=", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] }, "\n"
+                                ]]}
+                            },
+
+                            "/etc/s3cfg" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "access_key=", { "Ref":"GatlingKey" }, "\n",
+                                    "secret_key=", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] }, "\n"
+                                ]]}
+                            },
+                            "/etc/profile.d/maven.sh" : {
+                                "content" : { "Fn::Join" : ["", [
+                                    "export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1\n",
+                                    "export M2=$M2_HOME/bin\n",
+                                    "export MAVEN_OPTS=\"-Xms256m -Xmx512m\"\n",
+                                    "export PATH=$M2:$PATH\n"
+                                ]]}
+                            },
+
+                            "/etc/security/limits.d/gatling_filehandles.conf" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "ubuntu soft nofile 80000\n",
+                                    "ubuntu hard nofile 80000\n"
+                                ]]}
+                            }
+                        }
+                    }
+                },
+                "services" : {}
+            },
+            "Properties" : {
+                "KeyName" : { "Ref" : "KeyName" },
+                "ImageId" : {
+                    "Fn::FindInMap" : [
+                        "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
+                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "m1.xlarge", "Arch" ] } ]},
+                "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
+                "InstanceType" : { "Ref" : "InstanceType" },
+                "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
+                    "#!/bin/bash -xe\n",
+                    "apt-get install zip unzip wget -y\n",
+                    "wget https://bootstrap.pypa.io/ez_setup.py -O - | python\n",
+                    "easy_install  https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
+                    "/usr/local/bin/cfn-init -v ",
+                    "         --stack ", { "Ref" : "AWS::StackName" },
+                    "         --resource LaunchConfig ",
+                    "         --region ", { "Ref" : "AWS::Region" }, "\n",
+
+                    "/usr/local/bin/cfn-signal -e $? ",
+                    "         --stack ", { "Ref" : "AWS::StackName" },
+                    "         --resource GatlingServerGroup ",
+                    "         --region ", { "Ref" : "AWS::Region" }, "\n",
+
+                    "add-apt-repository ppa:webupd8team/java\n",
+                    "apt-get update\n",
+                    "echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections\n",
+                    "apt-get install oracle-java7-installer oracle-java7-set-default expect expect-dev git -y --force-yes\n",
+                    "update-java-alternatives -s java-7-oracle\n",
+
+                    "mkdir -p /usr/local/apache-maven\n",
+                    "cd /usr/local/apache-maven\n",
+                    "wget http://apache.mirrors.timporter.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz\n",
+                    "tar -xzvf apache-maven-3.1.1-bin.tar.gz\n",
+                    "cd ~ubuntu\n",
+                    "git clone https://github.com/apache/incubator-usergrid.git usergrid\n",
+                    "chown -R ubuntu:ubuntu usergrid\n"
+                ]]}}
+            }
+        },
+
+        "GatlingUser": {
+            "Type": "AWS::IAM::User",
+            "Properties": {
+                "Path": "/",
+                "Policies": [
+                    {
+                        "PolicyName": "root",
+                        "PolicyDocument": {
+                            "Statement": [
+                                {
+                                    "Effect": "Allow",
+                                    "Action": "*",
+                                    "Resource": "*"
+                                }
+                            ]
+                        }
+                    }
+                ]
+            }
+        },
+        "GatlingKey": {
+            "Type": "AWS::IAM::AccessKey",
+            "Properties": {
+                "UserName": {
+                    "Ref": "GatlingUser"
+                }
+            }
+        },
+
+        "WebServerScaleUpPolicy" : {
+            "Type" : "AWS::AutoScaling::ScalingPolicy",
+            "Properties" : {
+                "AdjustmentType" : "ChangeInCapacity",
+                "AutoScalingGroupName" : { "Ref" : "GatlingServerGroup" },
+                "Cooldown" : "60",
+                "ScalingAdjustment" : "1"
+            }
+        },
+        "WebServerScaleDownPolicy" : {
+            "Type" : "AWS::AutoScaling::ScalingPolicy",
+            "Properties" : {
+                "AdjustmentType" : "ChangeInCapacity",
+                "AutoScalingGroupName" : { "Ref" : "GatlingServerGroup" },
+                "Cooldown" : "60",
+                "ScalingAdjustment" : "-1"
+            }
+        },
+
+        "ElasticLoadBalancer" : {
+            "Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
+            "Properties" : {
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
+                "Listeners" : [ {
+                    "LoadBalancerPort" : "80",
+                    "InstancePort" : "80",
+                    "Protocol" : "HTTP"
+                } ],
+                "HealthCheck" : {
+                    "Target" : "HTTP:80/",
+                    "HealthyThreshold" : "3",
+                    "UnhealthyThreshold" : "5",
+                    "Interval" : "30",
+                    "Timeout" : "5"
+                }
+            }
+        },
+
+        "InstanceSecurityGroup" : {
+            "Type" : "AWS::EC2::SecurityGroup",
+            "Properties" : {
+                "GroupDescription" : "Enable SSH access and HTTP from the load balancer only",
+                "SecurityGroupIngress" : [ {
+                    "IpProtocol" : "tcp",
+                    "FromPort" : "22",
+                    "ToPort" : "22",
+                    "CidrIp" : { "Ref" : "SSHLocation"}
+                },
+                    {
+                        "IpProtocol" : "tcp",
+                        "FromPort" : "80",
+                        "ToPort" : "80",
+                        "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"]},
+                        "SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.GroupName"]}
+                    } ]
+            }
+        }
+    },
+
+    "Outputs" : {
+        "URL" : {
+            "Description" : "The URL of the website",
+            "Value" :  { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]}
+        }
+    }
+}
\ No newline at end of file


[13/16] incubator-usergrid git commit: Fixes missing constructor in location

Posted by sf...@apache.org.
Fixes missing constructor in location


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

Branch: refs/heads/two-dot-o
Commit: b9a2694daf124f3b19500aaa5479dcbbcdd1e40f
Parents: e7cd6f8
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 18:16:10 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 18:16:10 2014 -0700

----------------------------------------------------------------------
 .../usergrid/persistence/model/field/LocationField.java      | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b9a2694d/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/LocationField.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/LocationField.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/LocationField.java
index 407fd44..4605e1b 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/LocationField.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/LocationField.java
@@ -33,6 +33,14 @@ public class LocationField extends AbstractField<Location> {
     }
 
 
+    /**
+     * Required for Jackson, DO NOT DELETE
+     */
+    public LocationField() {
+        //required  do not delete
+        super();
+    }
+
 
     @Override
     public FieldTypeName getTypeName() {


[14/16] incubator-usergrid git commit: Updates PostUsers simulation to take into account only concurrent users.

Posted by sf...@apache.org.
Updates PostUsers simulation to take into account only concurrent users.


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

Branch: refs/heads/two-dot-o
Commit: ed587408e258ca34a21bfb2a32e2792b3ef352be
Parents: b9a2694
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 2 14:51:13 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 2 14:51:13 2014 -0700

----------------------------------------------------------------------
 .../simulations/PostUsersSimulation.scala       | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed587408/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
index 6992958..45a4437 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
@@ -21,8 +21,13 @@ import org.apache.usergrid.helpers.Setup
 import org.apache.usergrid.scenarios.UserScenarios
 import org.apache.usergrid.settings.Settings
 
-import scala.concurrent.duration._
-
+/**
+ * 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 PostUsersSimulation extends Simulation {
 
   println("Begin setup")
@@ -33,9 +38,14 @@ class PostUsersSimulation extends Simulation {
 
   setUp(
     UserScenarios.postUsersInfinitely
-      .inject(constantUsersPerSec(Settings.maxPossibleUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
-
-
-  )  .throttle(reachRps(Settings.maxPossibleUsers) in (Settings.rampTime.seconds)).protocols(Settings.httpConf.acceptHeader("application/json"))
+      .inject(
+        /**
+         * injection steps take from this forum post
+         * https://groups.google.com/forum/#!topic/gatling/JfYHaWCbA-w
+         */
+        rampUsersPerSec(1) to (Settings.maxPossibleUsers) during Settings.rampTime,
+        constantUsersPerSec(Settings.maxPossibleUsers) during Settings.duration
+
+      )).protocols(Settings.httpConf.acceptHeader("application/json"))
 
 }


[07/16] incubator-usergrid git commit: Updated NodeRegistry to only select running instances in describe

Posted by sf...@apache.org.
Updated NodeRegistry to only select running instances in describe

Updated yourkit to the latest version


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

Branch: refs/heads/two-dot-o
Commit: 91e25b5ecbccc205e97694851cf825994153e4f7
Parents: fd5be56
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 09:49:51 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 09:49:51 2014 -0700

----------------------------------------------------------------------
 .../main/dist/init_instance/install_yourkit.sh  |  6 +--
 .../src/main/groovy/NodeRegistry.groovy         | 45 ++++++++------------
 2 files changed, 21 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/91e25b5e/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh b/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
index ec1ac10..2bcfcd3 100644
--- a/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
+++ b/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
@@ -25,15 +25,15 @@ if [[ $YOURKIT = "true" ]]; then
 
 mkdir -p /mnt/yourkit
 cd /mnt/yourkit
-s3cmd --config=/etc/s3cfg get s3://${RELEASE_BUCKET}/yjp-2014-build-14110.zip
-unzip /mnt/yourkit/yjp-2014-build-14110.zip
+s3cmd --config=/etc/s3cfg get s3://${RELEASE_BUCKET}/yjp-2014-build-14114.zip
+unzip /mnt/yourkit/yjp-2014-build-14114.zip
 
 mkdir -p /mnt/yourkitreports
 
 chown -R tomcat7.tomcat7 /mnt/yourkitreports
 
 cat >> /etc/default/tomcat7 << EOF
-JAVA_OPTS="\${JAVA_OPTS} -agentpath:/mnt/yourkit/yjp-2014-build-14110/bin/linux-x86-64/libyjpagent.so=port=10001,logdir=/mnt/yourkitreports,dir=/mnt/yourkitreports,onexit=snapshot"
+JAVA_OPTS="\${JAVA_OPTS} -agentpath:/mnt/yourkit/yjp-2014-build-14114/bin/linux-x86-64/libyjpagent.so=port=10001,logdir=/mnt/yourkitreports,dir=/mnt/yourkitreports,onexit=snapshot"
 EOF
 
 fi

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/91e25b5e/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 80a20eb..51aa8af 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -32,6 +32,9 @@ class NodeRegistry {
     //taken from aws
     public static final String STACK_NAME = "usergrid:stack-name";
     public static final String NODE_TYPE = "usergrid:node_type";
+    public static final String SEARCH_INSTANCE_STATE = "instance-state-name";
+    public static final String SEARCH_STACK_NAME = TAG_PREFIX + STACK_NAME
+    public static final String SEARCH_NODE_TYPE = TAG_PREFIX + NODE_TYPE
 
     private String accessKey = (String) System.getenv().get("AWS_ACCESS_KEY")
     private String secretKey = (String) System.getenv().get("AWS_SECRET_KEY")
@@ -80,12 +83,12 @@ class NodeRegistry {
      */
     def searchNode(def nodeType) {
 
-        def stackNameFilter = new Filter(TAG_PREFIX+STACK_NAME).withValues(stackName)
-        def nodeTypeFilter = new Filter(TAG_PREFIX+NODE_TYPE).withValues(nodeType)
 
+        def stackNameFilter = new Filter(SEARCH_STACK_NAME).withValues(stackName)
+        def nodeTypeFilter = new Filter(SEARCH_NODE_TYPE).withValues(nodeType)
+        def instanceState = new Filter(SEARCH_INSTANCE_STATE).withValues(InstanceStateName.Running.toString());
 
-
-         //sort by created date
+        //sort by created date
         def servers = new TreeSet<ServerEntry>();
 
 
@@ -93,11 +96,11 @@ class NodeRegistry {
 
 
 
-        while(true){
+        while (true) {
 
-            def describeRequest = new DescribeInstancesRequest().withFilters(stackNameFilter, nodeTypeFilter)
+            def describeRequest = new DescribeInstancesRequest().withFilters(stackNameFilter, nodeTypeFilter, instanceState)
 
-            if(token != null){
+            if (token != null) {
                 describeRequest.withNextToken(token);
             }
 
@@ -108,27 +111,17 @@ class NodeRegistry {
 
                 //TODO, add these to a list then sort them by date, then name
                 for (instance in reservation.getInstances()) {
-
-                    //ignore instances that aren't running
-                    if (instance.state.getName() == InstanceStateName.Running.toString()) {
-                        servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName));
-                    }
-
-
+                    servers.add(new ServerEntry(instance.launchTime, instance.publicIpAddress));
                 }
 
             }
 
             //nothing to do, exit the loop
-            if(nodes.nextToken != null){
-                token = nodes.nextToken;
-            }
-            else{
+            if (nodes.nextToken == null) {
                 break;
             }
 
-
-
+            token = nodes.nextToken;
 
         }
 
@@ -138,19 +131,17 @@ class NodeRegistry {
         return createResults(servers);
     }
 
-    def createResults(def servers){
+    def createResults(def servers) {
 
         def results = [];
 
-        for(server in servers){
+        for (server in servers) {
             results.add(server.publicIp)
         }
 
         return results;
     }
 
-
-
     /**
      * Add the node to the database if it doesn't exist
      */
@@ -167,7 +158,7 @@ class NodeRegistry {
     }
 
 
-    class ServerEntry implements Comparable<ServerEntry>{
+    class ServerEntry implements Comparable<ServerEntry> {
         private final Date launchDate;
         private final String publicIp;
 
@@ -178,9 +169,9 @@ class NodeRegistry {
 
         @Override
         int compareTo(final ServerEntry o) {
-            if(launchDate.before(o.launchDate)){
+            if (launchDate.before(o.launchDate)) {
                 -1;
-            }else if (launchDate.after(o.launchDate)){
+            } else if (launchDate.after(o.launchDate)) {
                 return 1;
             }
 


[10/16] incubator-usergrid git commit: Added error message fix

Posted by sf...@apache.org.
Added error message fix


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

Branch: refs/heads/two-dot-o
Commit: a18e5de939030f8fc4e65fa12773d6a56e66c815
Parents: e3a2595
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 15:28:02 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 15:28:02 2014 -0700

----------------------------------------------------------------------
 .../serialization/impl/MvccEntitySerializationStrategyImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a18e5de9/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
index c9ec9a8..6badbc1 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
@@ -446,7 +446,7 @@ public abstract class MvccEntitySerializationStrategyImpl implements MvccEntityS
             catch ( DataCorruptionException e ) {
                 log.error(
                         "DATA CORRUPTION DETECTED when de-serializing entity with Id {} and version {}.  This means the"
-                                + " write was truncated.", id, version );
+                                + " write was truncated.", id, version, e );
                 //return an empty entity, we can never load this one, and we don't want it to bring the system
                 //to a grinding halt
                 return new MvccEntityImpl( id, version, MvccEntity.Status.DELETED, Optional.<Entity>absent() );


[11/16] incubator-usergrid git commit: Upgrades gatling version

Posted by sf...@apache.org.
Upgrades gatling version

Fixes jsonPath assertions to first check for entities[0]

Renamed create to be clearer when reading code


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

Branch: refs/heads/two-dot-o
Commit: 12a522ad1093a6d3f4efff7a49bdca6190be49ca
Parents: a18e5de
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 16:34:30 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 16:34:30 2014 -0700

----------------------------------------------------------------------
 stack/loadtests/README.md                        | 19 +++++++++++++++++++
 stack/loadtests/pom.xml                          |  4 ++--
 .../usergrid/scenarios/DeviceScenarios.scala     |  2 +-
 .../usergrid/scenarios/UserScenarios.scala       |  6 +++---
 .../simulations/PostUsersSimulation.scala        |  2 +-
 .../usergrid/simulations/SetupSimulation.scala   |  4 ++--
 stack/loadtests/src/test/scala/Engine.scala      |  4 ++--
 7 files changed, 30 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/README.md
----------------------------------------------------------------------
diff --git a/stack/loadtests/README.md b/stack/loadtests/README.md
index 87f4a67..14514c6 100644
--- a/stack/loadtests/README.md
+++ b/stack/loadtests/README.md
@@ -26,3 +26,22 @@ Gatling will run through mvn
 	Also see http://gatling.io/docs/2.0.2/general/simulation_setup.html
 	
 	Additional docs can be found here http://gatling.io/docs/2.0.2/
+
+##Running a Push Notification Simulation
+
+1. Set up all users in the system with 2 devices each.
+
+	>mvn compile gatling:execute -Dgatling.simulationClass=org.apache.usergrid.simulations.SetupSimulation -DadminUser=usergrid -DadminPassword=test -Dorg=usergrid  -Dapp=load -Dthrottle=100 -Dbaseurl=http://loadtest.usergrid.com -DmaxPossibleUsers=1000
+
+
+	Note the following.
+
+
+	**throttle:**  The max number of users + devices per second to create
+
+	**maxPossibleUsers:**  The maximum number of users the simulation will create before exiting
+
+
+1. No
+
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/pom.xml
----------------------------------------------------------------------
diff --git a/stack/loadtests/pom.xml b/stack/loadtests/pom.xml
index b08e58b..0389eda 100644
--- a/stack/loadtests/pom.xml
+++ b/stack/loadtests/pom.xml
@@ -52,9 +52,9 @@
 		<scala.version>2.10.4</scala.version>
 		<encoding>UTF-8</encoding>
 
-		<gatling.version>2.0.1</gatling.version>
+		<gatling.version>2.0.3</gatling.version>
     <gatling.plugin.version>2.0.0</gatling.plugin.version>
-		<gatling-highcharts.version>2.0.1</gatling-highcharts.version>
+		<gatling-highcharts.version>2.0.3</gatling-highcharts.version>
 
 		<scala-maven-plugin.version>3.1.6</scala-maven-plugin.version>
 	</properties>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
index 9385123..4abd8cb 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/DeviceScenarios.scala
@@ -50,7 +50,7 @@ object DeviceScenarios {
     .body(StringBody("""{"deviceModel":"Fake Device",
     "deviceOSVerion":"Negative Version",
     """" + notifier + """.notifier.id":"${entityName}"}"""))
-    .check(status.is(200), jsonPath("$..entities[0].uuid").exists , jsonPath("$..entities[0].uuid").saveAs("deviceId")))
+    .check(status.is(200),  jsonPath("$..entities[0]").exists , jsonPath("$..entities[0].uuid").exists , jsonPath("$..entities[0].uuid").saveAs("deviceId")))
 
 
   val postDeviceWithNotifier400ok = exec(http("Create device with notifier")

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/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 6fc5655..63466be 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
@@ -35,10 +35,10 @@ import io.gatling.core.Predef._
      http("GET user")
        .get("/users/${username}")
        .headers(Headers.jsonAuthorized)
-       .check(status.saveAs("userStatus"), jsonPath("$..entities[0].uuid").exists, jsonPath("$..entities[0].uuid").saveAs("userId"))
+       .check(status.saveAs("userStatus"), jsonPath("$..entities[0]").exists, jsonPath("$..entities[0].uuid").exists, jsonPath("$..entities[0].uuid").saveAs("userId"))
    )
 
-  val postUser =
+  val postUserIfNotExists =
     exec(getUserByUsername)
       .doIf ("${userStatus}", "404") {
      exec(
@@ -78,7 +78,7 @@ import io.gatling.core.Predef._
    val createUsersWithDevicesScenario =  scenario("Create Users")
      .feed(Settings.getInfiniteUserFeeder())
      .exec(TokenScenarios.getManagementToken)
-     .exec(UserScenarios.postUser)
+     .exec(UserScenarios.postUserIfNotExists)
      .exec(TokenScenarios.getUserToken)
      .exec(UserScenarios.getUserByUsername)
      .repeat(2){

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
index cbac041..1c998cc 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
@@ -43,7 +43,7 @@ class PostUsersSimulation extends Simulation {
 
   val scnToRun = scenario("POST geolocated users")
     .feed(feeder)
-    .exec(UserScenarios.postUser)
+    .exec(UserScenarios.postUserIfNotExists)
 
   setUp(scnToRun.inject(atOnceUsers(numUsers)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/SetupSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/SetupSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/SetupSimulation.scala
index ab68d98..567a510 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/SetupSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/SetupSimulation.scala
@@ -39,7 +39,7 @@ class SetupSimulation extends Simulation{
 
   setUp(
     UserScenarios.createUsersWithDevicesScenario
-      .inject(constantUsersPerSec(Settings.maxPossibleUsers) during (Settings.duration))
+      .inject(splitUsers(Settings.maxPossibleUsers) into( rampUsers(10) over (10 seconds)) separatedBy (10 seconds))
       .protocols(Settings.httpConf.acceptHeader("application/json"))
-  ).throttle(reachRps(Settings.throttle) in (Settings.rampTime seconds), holdFor(Settings.duration))
+  )
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/12a522ad/stack/loadtests/src/test/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/test/scala/Engine.scala b/stack/loadtests/src/test/scala/Engine.scala
index 48c93f8..0914589 100644
--- a/stack/loadtests/src/test/scala/Engine.scala
+++ b/stack/loadtests/src/test/scala/Engine.scala
@@ -25,8 +25,8 @@ object Engine extends App {
 	props.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
 	props.requestBodiesDirectory(IDEPathHelper.requestBodiesDirectory.toString)
 	props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
-  val simName = if(System.getProperty("simulationClass")!=null) System.getProperty("simulationClass") else "AppSimulation";
-  props.simulationClass("org.apache.usergrid.simulations."+simName)
+  val simName = if(System.getProperty("gatling.simulationClass")!=null) System.getProperty("gatling.simulationClass") else "org.apache.usergrid.simulations.AppSimulation";
+  props.simulationClass(simName)
 
 	Gatling.fromMap(props.build)
 }


[08/16] incubator-usergrid git commit: Updated registry to use public dns name

Posted by sf...@apache.org.
Updated registry to use public dns name


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

Branch: refs/heads/two-dot-o
Commit: 2e1d8bd96c01df4b7214f7b4e7165257d30fe76d
Parents: 91e25b5
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 10:01:07 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 10:01:07 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/src/main/groovy/NodeRegistry.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2e1d8bd9/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 51aa8af..0288ae4 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -111,7 +111,7 @@ class NodeRegistry {
 
                 //TODO, add these to a list then sort them by date, then name
                 for (instance in reservation.getInstances()) {
-                    servers.add(new ServerEntry(instance.launchTime, instance.publicIpAddress));
+                    servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName));
                 }
 
             }


[02/16] incubator-usergrid git commit: Merge branch 'APIBAAS-1391' of github.com:r3b/usergrid-1 into USERGRID-252

Posted by sf...@apache.org.
Merge branch 'APIBAAS-1391' of github.com:r3b/usergrid-1 into USERGRID-252


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

Branch: refs/heads/two-dot-o
Commit: 6d4a8231ba0a268fd70bf548dbde52d8130d57df
Parents: 2586e9f 3bc7a89
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Nov 24 16:09:14 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Nov 24 16:09:14 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json | 359 ++++++++++++++++++++++++++
 1 file changed, 359 insertions(+)
----------------------------------------------------------------------



[15/16] incubator-usergrid git commit: Updated ES configuration to temporarily remove additional threads

Posted by sf...@apache.org.
Updated ES configuration to temporarily remove additional threads


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

Branch: refs/heads/two-dot-o
Commit: 54294207a321d2a964433c8498425043b2208ae4
Parents: ed58740
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 2 16:46:27 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 2 16:46:27 2014 -0700

----------------------------------------------------------------------
 .../main/groovy/configure_elasticsearch.groovy  | 31 +++++++++++---------
 1 file changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54294207/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
index 79d5c35..7bee82c 100644
--- a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
+++ b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
@@ -61,22 +61,25 @@ es.logger.level: INFO
 
 #Set our threadpool size.  Our bulk pool and search pools are quite large.  We may want to turn these down if we
 #overload the system
-
-threadpool:
-    index:
-        type: fixed
-        size: 160
-        queue_size: 0
-    bulk:
-        type: fixed
-        size: 5000
+#
+# Temporarily removing.  We don't know better :)
+# http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_don_8217_t_touch_these_settings.html#_threadpools
+#
+#threadpool:
+#    index:
+#        type: fixed
+#        size: 160
+#        queue_size: 0
+#    bulk:
+#        type: fixed
+#        size: 5000
 #        size: 16
-        queue_size: 100
-    search:
-        size: 10000
+#        queue_size: 100
+#    search:
+#        size: 10000
 #        size: 48
-        type: fixed
-        queue_size: 100
+#        type: fixed
+#        queue_size: 100
 
 action.auto_create_index: false
 


[09/16] incubator-usergrid git commit: Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252

Posted by sf...@apache.org.
Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252


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

Branch: refs/heads/two-dot-o
Commit: e3a2595a46f1b17c6443440acc9cc4ac9ffe20bf
Parents: 2e1d8bd de455c3
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 15:26:11 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 15:26:11 2014 -0700

----------------------------------------------------------------------
 .../rest/management/users/UsersResource.java    |  38 ++-
 .../applications/queries/BasicGeoTests.java     | 268 +++++++++++++++++++
 .../applications/queries/basicGeoTests.java     | 184 -------------
 3 files changed, 292 insertions(+), 198 deletions(-)
----------------------------------------------------------------------



[04/16] incubator-usergrid git commit: Updated NodeRegistry to use only tags instead of external simple db

Posted by sf...@apache.org.
Updated NodeRegistry to use only tags instead of external simple db

Upgraded AWS client

Removed unused registry list groovy script


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

Branch: refs/heads/two-dot-o
Commit: b12130f06d503f8c5a3fc29d6049a4df89eb5a7e
Parents: 1f75549
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Nov 25 17:38:42 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Nov 25 17:38:42 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json        |  86 +++++++---
 stack/awscluster/pom.xml                        |   2 +-
 .../src/main/groovy/NodeRegistry.groovy         | 165 ++++++++++++-------
 .../src/main/groovy/registry_list.groovy        |  36 ----
 4 files changed, 168 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b12130f0/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
index ff41f14..b9f9752 100644
--- a/stack/awscluster/gatling-cluster-cf.json
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -1,53 +1,89 @@
 {
     "AWSTemplateFormatVersion" : "2010-09-09",
     "Description" : "Gatling cluster",
-
-    "Parameters" : {
+    "Parameters": {
         "InstanceCount": {
-            "Description" : "The number of gatling instances to create",
+            "Description": "The number of gatling instances to create",
             "Type": "Number",
             "Default": "1",
             "MinValue": "1"
         },
-
         "KeyName": {
-            "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
+            "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
             "Type": "AWS::EC2::KeyPair::KeyName",
-            "Default" : "jenkins-east",
-            "ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
+            "Default": "jenkins-east",
+            "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
         },
-
-        "InstanceType" : {
-            "Description" : "WebServer EC2 instance type",
-            "Type" : "String",
-            "Default" : "m1.xlarge",
-            "AllowedValues" : [ "t1.micro", "t2.micro", "t2.small", "t2.medium", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "g2.2xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"]
-            ,
-            "ConstraintDescription" : "must be a valid EC2 instance type."
+        "InstanceType": {
+            "Description": "WebServer EC2 instance type",
+            "Type": "String",
+            "Default": "m1.xlarge",
+            "AllowedValues": [
+                "t1.micro",
+                "t2.micro",
+                "t2.small",
+                "t2.medium",
+                "m1.small",
+                "m1.medium",
+                "m1.large",
+                "m1.xlarge",
+                "m2.xlarge",
+                "m2.2xlarge",
+                "m2.4xlarge",
+                "m3.medium",
+                "m3.large",
+                "m3.xlarge",
+                "m3.2xlarge",
+                "c1.medium",
+                "c1.xlarge",
+                "c3.large",
+                "c3.xlarge",
+                "c3.2xlarge",
+                "c3.4xlarge",
+                "c3.8xlarge",
+                "g2.2xlarge",
+                "r3.large",
+                "r3.xlarge",
+                "r3.2xlarge",
+                "r3.4xlarge",
+                "r3.8xlarge",
+                "i2.xlarge",
+                "i2.2xlarge",
+                "i2.4xlarge",
+                "i2.8xlarge",
+                "hi1.4xlarge",
+                "hs1.8xlarge",
+                "cr1.8xlarge",
+                "cc2.8xlarge",
+                "cg1.4xlarge"
+            ],
+            "ConstraintDescription": "must be a valid EC2 instance type."
         },
-
         "OperatorEMail": {
             "Description": "EMail address to notify if there are any scaling operations",
             "Type": "String",
             "AllowedPattern": "([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)",
             "ConstraintDescription": "must be a valid email address.",
-            "Default":"rbridges@apigee.com"
+            "Default": "rbridges@apigee.com"
         },
-
         "ReleaseBucket": {
             "Description": "S3 Bucket where Usergrid assembly is to be found.",
             "Type": "String",
             "Default": "usergrid-jenkins-builds"
         },
-
-        "SSHLocation" : {
-            "Description" : "The IP address range that can be used to SSH to the EC2 instances",
+        "SSHLocation": {
+            "Description": "The IP address range that can be used to SSH to the EC2 instances",
             "Type": "String",
             "MinLength": "9",
             "MaxLength": "18",
             "Default": "0.0.0.0/0",
             "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
             "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
+        },
+        "Branch": {
+            "Description": "The branch of usergrid to check out",
+            "Type": "String",
+            "Default": "two-dot-o"
         }
     },
 
@@ -231,15 +267,11 @@
                     "apt-add-repository ppa:awstools-dev/awstools --yes\n",
                     "apt-get update\n",
                     "echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections\n",
-                    "apt-get install oracle-java7-installer oracle-java7-set-default expect expect-dev git ec2-api-tools -y --force-yes\n",
+                    "apt-get install oracle-java7-installer oracle-java7-set-default expect expect-dev git ec2-api-tools maven -y --force-yes\n",
                     "update-java-alternatives -s java-7-oracle\n",
 
-                    "mkdir -p /usr/local/apache-maven\n",
-                    "cd /usr/local/apache-maven\n",
-                    "wget http://apache.mirrors.timporter.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz\n",
-                    "tar -xzvf apache-maven-3.1.1-bin.tar.gz\n",
                     "cd ~ubuntu\n",
-                    "git clone https://github.com/apache/incubator-usergrid.git usergrid\n",
+                    "git clone -b ",{ "Ref":"Branch" } , " https://github.com/apache/incubator-usergrid.git usergrid\n",
                     "chown -R ubuntu:ubuntu usergrid\n",
                     "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id)  --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName"  }, "-Gatling\n"
                 ]]}}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b12130f0/stack/awscluster/pom.xml
----------------------------------------------------------------------
diff --git a/stack/awscluster/pom.xml b/stack/awscluster/pom.xml
index 4a8f4d6..46157ab 100644
--- a/stack/awscluster/pom.xml
+++ b/stack/awscluster/pom.xml
@@ -215,7 +215,7 @@
     <dependency>
       <groupId>com.amazonaws</groupId>
       <artifactId>aws-java-sdk</artifactId>
-      <version>1.6.7</version>
+      <version>1.9.7</version>
     </dependency>
     <dependency>
       <artifactId>groovy-all</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b12130f0/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 6291f93..277631b 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -20,34 +20,64 @@
  * A utility class that search simple db for the node type provided and returns a list of hostnames as a string array
  */
 import com.amazonaws.auth.BasicAWSCredentials
-import com.amazonaws.services.simpledb.AmazonSimpleDBClient
-import com.amazonaws.services.simpledb.model.*
+import com.amazonaws.regions.Region
+import com.amazonaws.regions.Regions
+import com.amazonaws.services.ec2.model.DescribeInstancesRequest
+import com.amazonaws.services.ec2.model.DescribeInstancesResult
+import com.amazonaws.services.ec2.model.DescribeTagsRequest
+import com.amazonaws.services.ec2.AmazonEC2Client
+import com.amazonaws.services.ec2.model.CreateTagsRequest
+import com.amazonaws.services.ec2.model.Filter
+import com.amazonaws.services.ec2.model.Instance
+import com.amazonaws.services.ec2.model.Tag
 
 class NodeRegistry {
 
+
+    public static final String TAG_PREFIX = "tag:"
+    //taken from aws
+    public static final String STACK_NAME = "usergrid:stack-name";
+    public static final String NODE_TYPE = "usergrid:node_type";
+
     private String accessKey = (String) System.getenv().get("AWS_ACCESS_KEY")
     private String secretKey = (String) System.getenv().get("AWS_SECRET_KEY")
     private String stackName = (String) System.getenv().get("STACK_NAME")
-    private hostName = (String) System.getenv().get("PUBLIC_HOSTNAME")
+    private String instanceId = (String) System.getenv().get("EC2_INSTANCE_ID");
+    private String region = (String) System.getenv().get("EC2_REGION");
     private String domain = stackName
 
-    private def creds;
-    private def sdbClient;
+    private BasicAWSCredentials creds;
+    private AmazonEC2Client ec2Client;
 
 
     NodeRegistry() {
-        while ( true ) {
-            try {
-                // creates domain or no-op if it already exists
-                creds = new BasicAWSCredentials(accessKey, secretKey)
-                sdbClient = new AmazonSimpleDBClient(creds)
-                sdbClient.createDomain(new CreateDomainRequest(domain))
-
-            } catch ( Exception e ) {
-                continue
-            }
-            break
+
+        if (region == null) {
+            throw new IllegalArgumentException("EC2_REGION must be defined")
+        }
+
+        if (instanceId == null) {
+            throw new IllegalArgumentException("EC2_INSTANCE_ID must be defined")
+        }
+
+        if (stackName == null) {
+            throw new IllegalArgumentException("STACK_NAME must be defined")
+        }
+
+        if (accessKey == null) {
+            throw new IllegalArgumentException("AWS_ACCESS_KEY must be defined")
+        }
+
+        if (secretKey == null) {
+            throw new IllegalArgumentException("AWS_SECRET_KEY must be defined")
         }
+
+        creds = new BasicAWSCredentials(accessKey, secretKey)
+        ec2Client = new AmazonEC2Client(creds)
+        def regionEnum = Regions.fromName(region);
+        ec2Client.setRegion(Region.getRegion(regionEnum))
+
+
     }
 
     /**
@@ -55,64 +85,85 @@ class NodeRegistry {
      * @param defNodeType
      */
     def searchNode(def nodeType) {
-        //order by create time, if we have a conflict, then order by item name
-        def selectResult = sdbClient.select(new SelectRequest((String) \
-            "select * from `${domain}` where itemName() is not null AND createtime is not null AND nodetype = '${nodeType}'  order by createtime"))
-        def result = []
-
-        for (item in selectResult.getItems()) {
-            def hostname = item.getName()
-            result.add(hostname)
+
+        def stackNameFilter = new Filter(TAG_PREFIX+STACK_NAME).withValues(stackName);
+        def nodeTypeFilter = new Filter(TAG_PREFIX+NODE_TYPE).withValues(nodeType);
+
+        def describeRequest = new DescribeInstancesRequest().withFilters(stackNameFilter, nodeTypeFilter);
+
+
+        def nodes = ec2Client.describeInstances(describeRequest)
+
+        //sort by created date
+        def servers = [];
+
+        for(reservation in nodes.getReservations()){
+
+            //TODO, add these to a list then sort them by date, then name
+            for(instance in reservation.getInstances()){
+
+                servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName))
+            }
+
         }
 
-        return result
 
+
+        return createResults(servers);
     }
 
-    /**
-     * Get the entire database back in raw form
-     * @return
-     */
-    def selectAll() {
-        def selectResult = sdbClient.select(new SelectRequest((String) "select * from `${domain}`")).getItems()
+    def createResults(def servers){
+
+
+        Collections.sort(servers);
+        def results = [];
 
-        return selectResult;
+        for(server in servers){
+            results.add(server.publicIp)
+        }
+
+        return results;
     }
 
+
+
     /**
      * Add the node to the database if it doesn't exist
      */
     def addNode(def nodeType) {
-        def gar = new GetAttributesRequest(domain, hostName);
-        def response = sdbClient.getAttributes(gar);
-        if (response.getAttributes().size() == 1) {
-            println "Already registered"
-            def attrs = response.getAttributes()
-            for (att in attrs) {
-                println("${hostName} -> ${att.getName()} : ${att.getValue()}")
-            }
 
-            return false;
-
-        } else {
-            println "Registering..."
-            def stackAtt = new ReplaceableAttribute("nodetype", nodeType, true)
-            def nowString = Calendar.getInstance(TimeZone.getTimeZone('UTC')).format("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
-            def createTime = new ReplaceableAttribute("createtime", nowString, true)
-            def attrs = new ArrayList()
-            attrs.add(stackAtt)
-            attrs.add(createTime)
-            def par = new PutAttributesRequest(domain, hostName, attrs)
-            sdbClient.putAttributes(par);
-            println "Registration done."
-            return true;
-        }
+        //add the node type
+        def tagRequest = new CreateTagsRequest().withTags(new Tag(NODE_TYPE, nodeType), new Tag(STACK_NAME, stackName)).withResources(instanceId)
+
+
+
+        ec2Client.createTags(tagRequest)
 
 
     }
 
-    def deleteRegistry(){
-        sdbClient.deleteDomain(new DeleteDomainRequest(domain))
+
+    class ServerEntry implements Comparable<ServerEntry>{
+        private final Date launchDate;
+        private final String publicIp;
+
+        ServerEntry(final Date launchDate, final String publicIp) {
+            this.launchDate = launchDate
+            this.publicIp = publicIp
+        }
+
+        @Override
+        int compareTo(final ServerEntry o) {
+            if(launchDate.before(o.launchDate)){
+                -1;
+            }else if (launchDate.after(o.launchDate)){
+                return 1;
+            }
+
+            return publicIp.compareTo(o.publicIp);
+
+
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b12130f0/stack/awscluster/src/main/groovy/registry_list.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/registry_list.groovy b/stack/awscluster/src/main/groovy/registry_list.groovy
deleted file mode 100644
index ca3bcda..0000000
--- a/stack/awscluster/src/main/groovy/registry_list.groovy
+++ /dev/null
@@ -1,36 +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.
- */
-
-
-// 
-// registry_list.groovy 
-// 
-// List contents of registry as debugging aid. Not used in any other scripts. 
-//
-NodeRegistry registry = new NodeRegistry();
-
-
-
-
-for (item in registry.selectAll()) {
-    for(att in item.getAttributes()){
-        println "${item.getName()} -> ${att.getName()} : ${att.getValue()}"
-    }
-
-    println "\n"
-}


[05/16] incubator-usergrid git commit: Removed unused params in gatling cluster. Moved signal of success to last step

Posted by sf...@apache.org.
Removed unused params in gatling cluster.  Moved signal of success to last step

Updated key selection to be a drop down of valid ssh keys


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

Branch: refs/heads/two-dot-o
Commit: 65a018f8c06090d043d6016cc713941c1f30a91d
Parents: b12130f
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Nov 26 10:50:18 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Nov 26 10:50:18 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json | 19 +++++++------------
 stack/awscluster/ugcluster-cf.json       |  7 ++++---
 2 files changed, 11 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/65a018f8/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
index b9f9752..59090de 100644
--- a/stack/awscluster/gatling-cluster-cf.json
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -11,13 +11,13 @@
         "KeyName": {
             "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
             "Type": "AWS::EC2::KeyPair::KeyName",
-            "Default": "jenkins-east",
+            "Default": "ug-cloudformation",
             "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
         },
         "InstanceType": {
             "Description": "WebServer EC2 instance type",
             "Type": "String",
-            "Default": "m1.xlarge",
+            "Default": "c3.xlarge",
             "AllowedValues": [
                 "t1.micro",
                 "t2.micro",
@@ -66,11 +66,6 @@
             "ConstraintDescription": "must be a valid email address.",
             "Default": "rbridges@apigee.com"
         },
-        "ReleaseBucket": {
-            "Description": "S3 Bucket where Usergrid assembly is to be found.",
-            "Type": "String",
-            "Default": "usergrid-jenkins-builds"
-        },
         "SSHLocation": {
             "Description": "The IP address range that can be used to SSH to the EC2 instances",
             "Type": "String",
@@ -253,15 +248,11 @@
                     "wget https://bootstrap.pypa.io/ez_setup.py -O - | python\n",
                     "easy_install  https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
                     "## These don't seem to work correctly and cause script to bail.  Temporarily removing \n",
-                    "#/usr/local/bin/cfn-init -v ",
+                    "/usr/local/bin/cfn-init -v ",
                     "         --stack ", { "Ref" : "AWS::StackName" },
                     "         --resource LaunchConfig ",
                     "         --region ", { "Ref" : "AWS::Region" }, "\n",
 
-                    "#/usr/local/bin/cfn-signal -e $? ",
-                    "         --stack ", { "Ref" : "AWS::StackName" },
-                    "         --resource GatlingServerGroup ",
-                    "         --region ", { "Ref" : "AWS::Region" }, "\n",
 
                     "add-apt-repository ppa:webupd8team/java --yes\n",
                     "apt-add-repository ppa:awstools-dev/awstools --yes\n",
@@ -273,6 +264,10 @@
                     "cd ~ubuntu\n",
                     "git clone -b ",{ "Ref":"Branch" } , " https://github.com/apache/incubator-usergrid.git usergrid\n",
                     "chown -R ubuntu:ubuntu usergrid\n",
+
+
+                    "/usr/local/bin/cfn-signal --success true --stack ", { "Ref" : "AWS::StackName" }, " --resource GatlingServerGroup --region ", { "Ref" : "AWS::Region" }, "\n",
+
                     "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id)  --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName"  }, "-Gatling\n"
                 ]]}}
             }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/65a018f8/stack/awscluster/ugcluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/ugcluster-cf.json b/stack/awscluster/ugcluster-cf.json
index 5b599ec..02058e5 100644
--- a/stack/awscluster/ugcluster-cf.json
+++ b/stack/awscluster/ugcluster-cf.json
@@ -47,9 +47,10 @@
             "ConstraintDescription": "must be valid instance type."
         },
         "KeyPair": {
-            "Description": "EC2 key pair to be use for SSH access",
-            "Type": "String",
-            "Default": "ug-cloudformation"
+          "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
+          "Type": "AWS::EC2::KeyPair::KeyName",
+          "Default": "ug-cloudformation",
+          "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
         },
         "CassClusterName": {
             "Description": "Name to be used for Cassandra cluster.",


[12/16] incubator-usergrid git commit: Refactored post users simulation and user scenarios

Posted by sf...@apache.org.
Refactored post users simulation and user scenarios


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

Branch: refs/heads/two-dot-o
Commit: e7cd6f82d5597c785be10f2ab7c230166ae9fdd8
Parents: 12a522a
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 1 18:15:33 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 1 18:15:33 2014 -0700

----------------------------------------------------------------------
 .../usergrid/scenarios/UserScenarios.scala      | 50 +++++++++++++++-----
 .../org/apache/usergrid/settings/Settings.scala |  2 +-
 .../simulations/PostUsersSimulation.scala       | 35 +++++---------
 3 files changed, 51 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e7cd6f82/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 63466be..7d1c9b5 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
@@ -38,20 +38,33 @@ import io.gatling.core.Predef._
        .check(status.saveAs("userStatus"), jsonPath("$..entities[0]").exists, jsonPath("$..entities[0].uuid").exists, jsonPath("$..entities[0].uuid").saveAs("userId"))
    )
 
-  val postUserIfNotExists =
-    exec(getUserByUsername)
-      .doIf ("${userStatus}", "404") {
+
+   /**
+    * Post a user
+    */
+   val postUser =
+
      exec(
-       http("POST geolocated Users")
-         .post("/users")
-         .body(new 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.saveAs("userStatus"))
-         .check(status.is(200),jsonPath("$..entities[0].uuid").saveAs("userId"))
-     )
-    }
+            http("POST geolocated Users")
+              .post("/users")
+              .body(new 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.saveAs("userStatus"))
+              .check(status.is(200),jsonPath("$..entities[0].uuid").saveAs("userId"))
+          )
+
+
+   /**
+     * Try to get a user, if it returns a 404, create the user
+     */
+   val postUserIfNotExists =
+     exec(getUserByUsername)
+       .doIf ("${userStatus}", "404") {
+      exec(postUser)
+     }
+
 
    val putUser =
      exec(getUserByUsername)
@@ -75,6 +88,10 @@ import io.gatling.core.Predef._
        .check(status.is(200), jsonPath("$..entities[0].uuid").saveAs("userId"))
    )
 
+   /**
+    * Logs in as the admin user.  Checks if a user exists, if not, creates the user
+    * Logs in as the user, then creates 2 devices if they do not exist
+    */
    val createUsersWithDevicesScenario =  scenario("Create Users")
      .feed(Settings.getInfiniteUserFeeder())
      .exec(TokenScenarios.getManagementToken)
@@ -85,4 +102,11 @@ import io.gatling.core.Predef._
        feed(FeederGenerator.generateEntityNameFeeder("device", Settings.numDevices))
          .exec( DeviceScenarios.maybeCreateDevices)
      }
+
+   /**
+    * Posts a new user every time
+    */
+   val postUsersInfinitely =  scenario("Post Users")
+        .feed(Settings.getInfiniteUserFeeder())
+        .exec(UserScenarios.postUser)
  }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e7cd6f82/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 570b404..4ef28c1 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
@@ -58,7 +58,7 @@ object Settings {
   val pushNotifier = if (System.getProperty("pushNotifier") != null)  System.getProperty("pushNotifier") else "loadNotifier"
   val pushProvider =  if (System.getProperty("pushProvider") != null)  System.getProperty("pushProvider")  else "noop"
 
-  println(s"Will inject $maxPossibleUsers users per sec")
+  println(s"Will inject up to $maxPossibleUsers users per sec")
 
    def getUserFeeder():Array[Map[String, String]]= {
     val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsers, userLocationRadius, centerLatitude, centerLongitude)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e7cd6f82/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
index 1c998cc..6992958 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PostUsersSimulation.scala
@@ -14,37 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.simulations
+package org.apache.usergrid.simulations
 
 import io.gatling.core.Predef._
- import org.apache.usergrid.datagenerators.FeederGenerator
- import org.apache.usergrid.scenarios.UserScenarios
- import org.apache.usergrid.settings.Settings
+import org.apache.usergrid.helpers.Setup
+import org.apache.usergrid.scenarios.UserScenarios
+import org.apache.usergrid.settings.Settings
 
- import scala.concurrent.duration._
+import scala.concurrent.duration._
 
 class PostUsersSimulation extends Simulation {
 
-  // Target settings
-  val httpConf = Settings.httpConf
+  println("Begin setup")
+  Setup.setupOrg()
+  Setup.setupApplication()
+  println("End Setup")
 
-  // Simulation settings
-  val numUsers:Int = Settings.numUsers
-  val rampTime:Int = Settings.rampTime
-  val throttle:Int = Settings.throttle
 
-  // Geolocation settings
-  val centerLatitude:Double = Settings.centerLatitude
-  val centerLongitude:Double = Settings.centerLongitude
-  val userLocationRadius:Double = Settings.userLocationRadius
-  val geosearchRadius:Int = Settings.geosearchRadius
+  setUp(
+    UserScenarios.postUsersInfinitely
+      .inject(constantUsersPerSec(Settings.maxPossibleUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
 
-  val feeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsers, userLocationRadius, centerLatitude, centerLongitude).queue
 
-  val scnToRun = scenario("POST geolocated users")
-    .feed(feeder)
-    .exec(UserScenarios.postUserIfNotExists)
-
-  setUp(scnToRun.inject(atOnceUsers(numUsers)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
+  )  .throttle(reachRps(Settings.maxPossibleUsers) in (Settings.rampTime.seconds)).protocols(Settings.httpConf.acceptHeader("application/json"))
 
 }


[03/16] incubator-usergrid git commit: Updated gatling cluster launcher to tag instances

Posted by sf...@apache.org.
Updated gatling cluster launcher to tag instances


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

Branch: refs/heads/two-dot-o
Commit: 1f75549e9971f80ff56cc60774318e6f08a4cb38
Parents: 6d4a823
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Nov 24 17:47:47 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Nov 24 17:47:47 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1f75549e/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
index 16b8d5b..ff41f14 100644
--- a/stack/awscluster/gatling-cluster-cf.json
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -216,20 +216,22 @@
                     "apt-get install zip unzip wget -y\n",
                     "wget https://bootstrap.pypa.io/ez_setup.py -O - | python\n",
                     "easy_install  https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
-                    "/usr/local/bin/cfn-init -v ",
+                    "## These don't seem to work correctly and cause script to bail.  Temporarily removing \n",
+                    "#/usr/local/bin/cfn-init -v ",
                     "         --stack ", { "Ref" : "AWS::StackName" },
                     "         --resource LaunchConfig ",
                     "         --region ", { "Ref" : "AWS::Region" }, "\n",
 
-                    "/usr/local/bin/cfn-signal -e $? ",
+                    "#/usr/local/bin/cfn-signal -e $? ",
                     "         --stack ", { "Ref" : "AWS::StackName" },
                     "         --resource GatlingServerGroup ",
                     "         --region ", { "Ref" : "AWS::Region" }, "\n",
 
-                    "add-apt-repository ppa:webupd8team/java\n",
+                    "add-apt-repository ppa:webupd8team/java --yes\n",
+                    "apt-add-repository ppa:awstools-dev/awstools --yes\n",
                     "apt-get update\n",
                     "echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections\n",
-                    "apt-get install oracle-java7-installer oracle-java7-set-default expect expect-dev git -y --force-yes\n",
+                    "apt-get install oracle-java7-installer oracle-java7-set-default expect expect-dev git ec2-api-tools -y --force-yes\n",
                     "update-java-alternatives -s java-7-oracle\n",
 
                     "mkdir -p /usr/local/apache-maven\n",
@@ -238,7 +240,8 @@
                     "tar -xzvf apache-maven-3.1.1-bin.tar.gz\n",
                     "cd ~ubuntu\n",
                     "git clone https://github.com/apache/incubator-usergrid.git usergrid\n",
-                    "chown -R ubuntu:ubuntu usergrid\n"
+                    "chown -R ubuntu:ubuntu usergrid\n",
+                    "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id)  --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName"  }, "-Gatling\n"
                 ]]}}
             }
         },
@@ -356,4 +359,4 @@
             "Value" :  { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]}
         }
     }
-}
\ No newline at end of file
+}


[06/16] incubator-usergrid git commit: Fixes bug with gatling registration

Posted by sf...@apache.org.
Fixes bug with gatling registration

Fixes bug with instance states and not running instances


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

Branch: refs/heads/two-dot-o
Commit: fd5be56925885b74739c9f16b6d37bd5a8ab7abf
Parents: 65a018f
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Nov 26 16:32:50 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Nov 26 17:08:25 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json        | 12 ++-
 .../src/main/groovy/NodeRegistry.groovy         | 81 +++++++++++++++-----
 2 files changed, 67 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fd5be569/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
index 59090de..4345e1e 100644
--- a/stack/awscluster/gatling-cluster-cf.json
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -216,10 +216,10 @@
                             },
                             "/etc/profile.d/maven.sh" : {
                                 "content" : { "Fn::Join" : ["", [
-                                    "export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1\n",
-                                    "export M2=$M2_HOME/bin\n",
+                                    "export M3_HOME=/usr/local/apache-maven/apache-maven-3.1.1\n",
+                                    "export M3=$M3_HOME/bin\n",
                                     "export MAVEN_OPTS=\"-Xms256m -Xmx512m\"\n",
-                                    "export PATH=$M2:$PATH\n"
+                                    "export PATH=$M3:$PATH\n"
                                 ]]}
                             },
 
@@ -265,10 +265,8 @@
                     "git clone -b ",{ "Ref":"Branch" } , " https://github.com/apache/incubator-usergrid.git usergrid\n",
                     "chown -R ubuntu:ubuntu usergrid\n",
 
-
-                    "/usr/local/bin/cfn-signal --success true --stack ", { "Ref" : "AWS::StackName" }, " --resource GatlingServerGroup --region ", { "Ref" : "AWS::Region" }, "\n",
-
-                    "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id)  --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName"  }, "-Gatling\n"
+                    "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id)  --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName"  }, "-Gatling\n",
+                    "/usr/local/bin/cfn-signal --success true --stack ", { "Ref" : "AWS::StackName" }, " --resource GatlingServerGroup --region ", { "Ref" : "AWS::Region" }, "\n"
                 ]]}}
             }
         },

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fd5be569/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 277631b..80a20eb 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -22,14 +22,8 @@
 import com.amazonaws.auth.BasicAWSCredentials
 import com.amazonaws.regions.Region
 import com.amazonaws.regions.Regions
-import com.amazonaws.services.ec2.model.DescribeInstancesRequest
-import com.amazonaws.services.ec2.model.DescribeInstancesResult
-import com.amazonaws.services.ec2.model.DescribeTagsRequest
 import com.amazonaws.services.ec2.AmazonEC2Client
-import com.amazonaws.services.ec2.model.CreateTagsRequest
-import com.amazonaws.services.ec2.model.Filter
-import com.amazonaws.services.ec2.model.Instance
-import com.amazonaws.services.ec2.model.Tag
+import com.amazonaws.services.ec2.model.*
 
 class NodeRegistry {
 
@@ -86,36 +80,66 @@ class NodeRegistry {
      */
     def searchNode(def nodeType) {
 
-        def stackNameFilter = new Filter(TAG_PREFIX+STACK_NAME).withValues(stackName);
-        def nodeTypeFilter = new Filter(TAG_PREFIX+NODE_TYPE).withValues(nodeType);
+        def stackNameFilter = new Filter(TAG_PREFIX+STACK_NAME).withValues(stackName)
+        def nodeTypeFilter = new Filter(TAG_PREFIX+NODE_TYPE).withValues(nodeType)
 
-        def describeRequest = new DescribeInstancesRequest().withFilters(stackNameFilter, nodeTypeFilter);
 
 
-        def nodes = ec2Client.describeInstances(describeRequest)
+         //sort by created date
+        def servers = new TreeSet<ServerEntry>();
 
-        //sort by created date
-        def servers = [];
 
-        for(reservation in nodes.getReservations()){
+        def token = null
 
-            //TODO, add these to a list then sort them by date, then name
-            for(instance in reservation.getInstances()){
 
-                servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName))
+
+        while(true){
+
+            def describeRequest = new DescribeInstancesRequest().withFilters(stackNameFilter, nodeTypeFilter)
+
+            if(token != null){
+                describeRequest.withNextToken(token);
+            }
+
+
+            def nodes = ec2Client.describeInstances(describeRequest)
+
+            for (reservation in nodes.getReservations()) {
+
+                //TODO, add these to a list then sort them by date, then name
+                for (instance in reservation.getInstances()) {
+
+                    //ignore instances that aren't running
+                    if (instance.state.getName() == InstanceStateName.Running.toString()) {
+                        servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName));
+                    }
+
+
+                }
+
             }
 
+            //nothing to do, exit the loop
+            if(nodes.nextToken != null){
+                token = nodes.nextToken;
+            }
+            else{
+                break;
+            }
+
+
+
+
         }
 
 
 
+
         return createResults(servers);
     }
 
     def createResults(def servers){
 
-
-        Collections.sort(servers);
         def results = [];
 
         for(server in servers){
@@ -164,6 +188,25 @@ class NodeRegistry {
 
 
         }
+
+        boolean equals(final o) {
+            if (this.is(o)) return true
+            if (getClass() != o.class) return false
+
+            final ServerEntry that = (ServerEntry) o
+
+            if (launchDate != that.launchDate) return false
+            if (publicIp != that.publicIp) return false
+
+            return true
+        }
+
+        int hashCode() {
+            int result
+            result = launchDate.hashCode()
+            result = 31 * result + publicIp.hashCode()
+            return result
+        }
     }
 
 }


[16/16] incubator-usergrid git commit: Added build option for additional debug information to make profiling easier

Posted by sf...@apache.org.
Added build option for additional debug information to make profiling easier


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

Branch: refs/heads/two-dot-o
Commit: c2bc921db5e210285a35f569e7d003f404e7baae
Parents: 5429420
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 2 16:50:12 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 2 16:50:12 2014 -0700

----------------------------------------------------------------------
 stack/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c2bc921d/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 5a7bdd3..e02a08e 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -1518,6 +1518,7 @@
             <optimize>true</optimize>
             <showDeprecation>true</showDeprecation>
             <debug>true</debug>
+            <!-- uncomment when building for more detailed profiling information <debuglevel>lines,vars,source</debuglevel> -->
             <encoding>UTF-8</encoding>
             <showWarnings>true</showWarnings>
           </configuration>