You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/08/15 00:01:04 UTC
[1/2] git commit: Set Tomcat threads and memory based on AWS instance
type.
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o 6a9bb7434 -> 5878b4060
Set Tomcat threads and memory based on AWS instance type.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/630e6210
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/630e6210
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/630e6210
Branch: refs/heads/two-dot-o
Commit: 630e6210d8de071bf6dd2e0c9108df97cd8c31af
Parents: 6a9bb74
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Aug 14 17:53:18 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Aug 14 17:53:18 2014 -0400
----------------------------------------------------------------------
.../main/dist/init_instance/init_rest_server.sh | 51 +++++--
.../src/main/dist/lib/log4j.properties | 21 +--
stack/awscluster/src/main/dist/lib/server.xml | 145 -------------------
.../src/main/groovy/configure_usergrid.groovy | 5 +
4 files changed, 57 insertions(+), 165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/630e6210/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
index 2a008eb..97d7082 100644
--- a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
+++ b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
@@ -46,14 +46,6 @@ ln -s /home/ubuntu/.groovy /root/.groovy
. /etc/profile.d/usergrid-env.sh
chmod +x /usr/share/usergrid/update.sh
-# Copy in our own server.xml to set Tomcat's thread pool size
-cp /usr/share/usergrid/lib/server.xml /var/lib/tomcat7/conf
-chown tomcat7 /var/lib/tomcat7/conf/server.xml
-
-# Set Tomcat RAM size and path to log4j.properties
-export JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -Dlog4j.configuration=file:/usr/share/usergrid/lib/log4j.properties"
-sed -i 's/Xmx128m/Xmx1024m -Dlog4j.configuration=file\:\/usr\/share\/usergrid\/lib\/log4j\.properties/' /etc/default/tomcat7
-
cd /usr/share/usergrid/init_instance
./install_oraclejdk.sh
@@ -78,9 +70,48 @@ ln -s /var/log varlog/tomcat7 tomcat7logs
ln -s /usr/share/tomcat7 tomcat7
ln -s /usr/share/usergrid usergrid
-# Go
-/etc/init.d/tomcat7 start
+case `(curl http://169.254.169.254/latest/meta-data/instance-type)` in
+'m1.small' )
+ export TOMCAT_RAM=1250M
+ export TOMCAT_THREADS=250
+;;
+'m1.medium' )
+ export TOMCAT_RAM=3G
+ export TOMCAT_THREADS=500
+;;
+'m1.large' )
+ export TOMCAT_RAM=6G
+ export TOMCAT_THREADS=1000
+;;
+'m1.xlarge' )
+ export TOMCAT_RAM=12G
+ export TOMCAT_THREADS=2000
+;;
+'m3.xlarge' )
+ export TOMCAT_RAM=12G
+ export TOMCAT_THREADS=3250
+;;
+'m3.large' )
+ export TOMCAT_RAM=6G
+ export TOMCAT_THREADS=1600
+;;
+'c3.4xlarge' )
+ export TOMCAT_RAM=24G
+ export TOMCAT_THREADS=15000
+ export NOFILE=400000
+esac
+
+sudo sed -i.bak "s/Xmx128m/Xmx${TOMCAT_RAM} -Xms${TOMCAT_RAM}/g" /etc/default/tomcat7
+sudo sed -i.bak "s/<Connector/<Connector maxThreads=\"${TOMCAT_THREADS}\" acceptCount=\"${TOMCAT_THREADS}\" maxConnections=\"${TOMCAT_THREADS}\"/g" /var/lib/tomcat7/conf/server.xml
+sudo sed -i.bak "/@student/a *\t\thard\tnofile\t\t${NOFILE}\n*\t\tsoft\tnofile\t\t${NOFILE}" /etc/security/limits.conf
+echo 600000 | sudo tee /proc/sys/fs/nr_open
+echo 600000 | sudo tee /proc/sys/fs/file-max
# tag last so we can see in the console that the script ran to completion
cd /usr/share/usergrid/scripts
groovy tag_instance.groovy
+
+# Go
+/etc/init.d/tomcat7 start
+sudo reboot
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/630e6210/stack/awscluster/src/main/dist/lib/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/lib/log4j.properties b/stack/awscluster/src/main/dist/lib/log4j.properties
index bf98cdf..52f99ce 100644
--- a/stack/awscluster/src/main/dist/lib/log4j.properties
+++ b/stack/awscluster/src/main/dist/lib/log4j.properties
@@ -28,16 +28,16 @@ log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) %c{1} - %m%n
log4j.logger.org.apache.usergrid=INFO
-#log4j.logger.org.apache.usergrid.persistence.cassandra.DB=WARN, stdout
-#log4j.logger.org.apache.usergrid.persistence.cassandra.BATCH=WARN, stdout
-#log4j.logger.org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl=WARN, stdout
-#log4j.logger.org.apache.usergrid.persistence.cassandra.DaoUtils=WARN, stdout
-#log4j.logger.org.apache.usergrid.persistence.cassandra.EntityManagerImpl=WARN, stdout
-#log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN, stdout
-#log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
-#log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
-#log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
-#log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.DB=WARN, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.BATCH=WARN, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl=WARN, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.DaoUtils=WARN, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.EntityManagerImpl=WARN, stdout
+log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN, stdout
+log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
+log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
+log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
+log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
#log4j.logger.org.apache.usergrid.persistence=INFO
#log4j.logger.org.apache.usergrid.corepersistence=DEBUG
@@ -48,6 +48,7 @@ log4j.logger.org.apache.usergrid=INFO
#log4j.logger.org.apache.usergrid.persistence.index=DEBUG
#log4j.logger.org.apache.usergrid.persistence.collection=DEBUG
#log4j.logger.org.elasticsearch=DEBUG
+log4j.logger.org.apache.usergrid.rest.filters.MeteringFilter=ERROR
#log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG, stdout
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/630e6210/stack/awscluster/src/main/dist/lib/server.xml
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/lib/server.xml b/stack/awscluster/src/main/dist/lib/server.xml
deleted file mode 100644
index 40685a7..0000000
--- a/stack/awscluster/src/main/dist/lib/server.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
- 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.
--->
-<!-- Note: A "Server" is not itself a "Container", so you may not
- define subcomponents such as "Valves" at this level.
- Documentation at /docs/config/server.html
- -->
-
- <!-- Modified for Usergrid to set the threads to 600 -->
-
-<Server port="8005" shutdown="SHUTDOWN">
- <!-- Security listener. Documentation at /docs/config/listeners.html
- <Listener className="org.apache.catalina.security.SecurityListener" />
- -->
- <!--APR library loader. Documentation at /docs/apr.html -->
- <!--
- <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
- -->
- <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
- <Listener className="org.apache.catalina.core.JasperListener" />
- <!-- Prevent memory leaks due to use of particular java/javax APIs-->
- <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
- <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
- <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
-
- <!-- Global JNDI resources
- Documentation at /docs/jndi-resources-howto.html
- -->
- <GlobalNamingResources>
- <!-- Editable user database that can also be used by
- UserDatabaseRealm to authenticate users
- -->
- <Resource name="UserDatabase" auth="Container"
- type="org.apache.catalina.UserDatabase"
- description="User database that can be updated and saved"
- factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
- pathname="conf/tomcat-users.xml" />
- </GlobalNamingResources>
-
- <!-- A "Service" is a collection of one or more "Connectors" that share
- a single "Container" Note: A "Service" is not itself a "Container",
- so you may not define subcomponents such as "Valves" at this level.
- Documentation at /docs/config/service.html
- -->
- <Service name="Catalina">
-
- <!--The connectors can use a shared executor, you can define one or more named thread pools-->
- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
- maxThreads="600" minSpareThreads="4"/>
-
- <!-- A "Connector" represents an endpoint by which requests are received
- and responses are returned. Documentation at :
- Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
- Java AJP Connector: /docs/config/ajp.html
- APR (HTTP/AJP) Connector: /docs/apr.html
- Define a non-SSL HTTP/1.1 Connector on port 8080
- -->
- <Connector port="8080" protocol="HTTP/1.1"
- connectionTimeout="20000"
- URIEncoding="UTF-8"
- redirectPort="8443" />
- <!-- A "Connector" using the shared thread pool-->
- <!--
- <Connector executor="tomcatThreadPool"
- port="8080" protocol="HTTP/1.1"
- connectionTimeout="20000"
- redirectPort="8443" />
- -->
- <!-- Define a SSL HTTP/1.1 Connector on port 8443
- This connector uses the JSSE configuration, when using APR, the
- connector should be using the OpenSSL style configuration
- described in the APR documentation -->
- <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
- maxThreads="600" scheme="https" secure="true"
- clientAuth="false" sslProtocol="TLS" /> -->
-
- <!-- Define an AJP 1.3 Connector on port 8009 -->
- <!--
- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
- -->
-
-
- <!-- An Engine represents the entry point (within Catalina) that processes
- every request. The Engine implementation for Tomcat stand alone
- analyzes the HTTP headers included with the request, and passes them
- on to the appropriate Host (virtual host).
- Documentation at /docs/config/engine.html -->
-
- <!-- You should set jvmRoute to support load-balancing via AJP ie :
- <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
- -->
- <Engine name="Catalina" defaultHost="localhost">
-
- <!--For clustering, please take a look at documentation at:
- /docs/cluster-howto.html (simple how to)
- /docs/config/cluster.html (reference documentation) -->
- <!--
- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
- -->
-
- <!-- Use the LockOutRealm to prevent attempts to guess user passwords
- via a brute-force attack -->
- <Realm className="org.apache.catalina.realm.LockOutRealm">
- <!-- This Realm uses the UserDatabase configured in the global JNDI
- resources under the key "UserDatabase". Any edits
- that are performed against this UserDatabase are immediately
- available for use by the Realm. -->
- <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
- resourceName="UserDatabase"/>
- </Realm>
-
- <Host name="localhost" appBase="webapps"
- unpackWARs="true" autoDeploy="true">
-
- <!-- SingleSignOn valve, share authentication between web applications
- Documentation at: /docs/config/valve.html -->
- <!--
- <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
- -->
-
- <!-- Access log processes all example.
- Documentation at: /docs/config/valve.html
- Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
- prefix="localhost_access_log." suffix=".txt"
- pattern="%h %l %u %t "%r" %s %b" />
-
- </Host>
- </Engine>
- </Service>
-</Server>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/630e6210/stack/awscluster/src/main/groovy/configure_usergrid.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_usergrid.groovy b/stack/awscluster/src/main/groovy/configure_usergrid.groovy
index f85b2cb..d793a81 100644
--- a/stack/awscluster/src/main/groovy/configure_usergrid.groovy
+++ b/stack/awscluster/src/main/groovy/configure_usergrid.groovy
@@ -80,6 +80,11 @@ cassandra.cluster=${clusterName}
cassandra.keyspace.strategy=org.apache.cassandra.locator.SimpleStrategy
cassandra.keyspace.replication=${replFactor}
+cassandra.timeout=2000
+cassandra.connections=800
+hystrix.threadpool.graph_user.coreSize=60
+hystrix.threadpool.graph_async.coreSize=60
+
elasticsearch.cluster_name=${clusterName}
elasticsearch.index_prefix=usergrid
elasticsearch.hosts=${esnodes}
[2/2] git commit: Property settings to allow Core and Services tests
to run (and succeed) consistently, REST still needs some work.
Posted by sn...@apache.org.
Property settings to allow Core and Services tests to run (and succeed) consistently, REST still needs some work.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5878b406
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5878b406
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5878b406
Branch: refs/heads/two-dot-o
Commit: 5878b4060fca47fc9068e8a5cd5285f9fb9f7941
Parents: 630e621
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Aug 14 17:54:07 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Aug 14 17:54:07 2014 -0400
----------------------------------------------------------------------
.../usergrid/persistence/CollectionIT.java | 2 +-
.../resources/usergrid-custom-test.properties | 27 +++++++++-----
.../resources/usergrid-custom-test.properties | 38 +++++++++++++-------
.../resources/usergrid-custom-test.properties | 26 +++++++++-----
4 files changed, 63 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5878b406/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
index 19d82be..6971217 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
@@ -573,7 +573,7 @@ public class CollectionIT extends AbstractCoreIT {
public void emptyQueryReverse() throws Exception {
LOG.debug( "emptyQueryReverse" );
- UUID applicationId = setup.createApplication( "testOrganization", "testEmptyQueryReverse" );
+ UUID applicationId = setup.createApplication( "emptyQueryReverseOrg", "testEmptyQueryReverseApp" );
assertNotNull( applicationId );
EntityManager em = setup.getEmf().getEntityManager( applicationId );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5878b406/stack/core/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/usergrid-custom-test.properties b/stack/core/src/test/resources/usergrid-custom-test.properties
index 62b4695..71ed1d4 100644
--- a/stack/core/src/test/resources/usergrid-custom-test.properties
+++ b/stack/core/src/test/resources/usergrid-custom-test.properties
@@ -1,13 +1,22 @@
+# Licensed 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. See accompanying LICENSE file.
-cassandra.startup=embedded
+# Core module test properties
+# these settings allow tests to run and consistently pass on 16GB MacBook Pro
+# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
+cassandra.startup=embedded
elasticsearch.startup=embedded
-
cassandra.timeout=5000
-cassandra.connections=1200
-
-collection.stage.transient.timeout=5
-
-hystrix.threadpool.graph_user.coreSize=40
-hystrix.threadpool.graph_async.coreSize=40
-
+cassandra.connections=1000
+hystrix.threadpool.graph_user.coreSize=100
+hystrix.threadpool.graph_async.coreSize=100
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5878b406/stack/rest/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/usergrid-custom-test.properties b/stack/rest/src/test/resources/usergrid-custom-test.properties
index fcb1630..901952f 100644
--- a/stack/rest/src/test/resources/usergrid-custom-test.properties
+++ b/stack/rest/src/test/resources/usergrid-custom-test.properties
@@ -1,20 +1,34 @@
+# Licensed 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. See accompanying LICENSE file.
-usergrid.test=true
-
-usergrid.mongo.disable=true
-usergrid.counter.batch.size=1
-swagger.basepath=http://sometestvalue
+# REST module test properties
+# these settings allow tests to run and consistently pass on 16GB MacBook Pro
+# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
tomcat.startup=embedded
-
-elasticsearch.startup=forked
-elasticsearch.force_refresh=false
-
cassandra.startup=forked
-cassandra.connections=600
+elasticsearch.startup=forked
cassandra.timeout=5000
+cassandra.connections=600
+hystrix.threadpool.graph_user.coreSize=30
+hystrix.threadpool.graph_async.coreSize=30
-hystrix.threadpool.graph_user.coreSize=20
-hystrix.threadpool.graph_async.coreSize=20
+# needed to enable refresh and properties end-points used in tests
+usergrid.test=true
+# needed for DuplicateNameIT
collection.stage.transient.timeout=5
+
+# other...
+usergrid.mongo.disable=true
+usergrid.counter.batch.size=1
+swagger.basepath=http://sometestvalue
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5878b406/stack/services/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/services/src/test/resources/usergrid-custom-test.properties b/stack/services/src/test/resources/usergrid-custom-test.properties
index c173396..7f141f8 100644
--- a/stack/services/src/test/resources/usergrid-custom-test.properties
+++ b/stack/services/src/test/resources/usergrid-custom-test.properties
@@ -1,12 +1,22 @@
+# Licensed 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. See accompanying LICENSE file.
-cassandra.startup=embedded
+# Services module test properties
+# these settings allow tests to run and consistently pass on 16GB MacBook Pro
+# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
+cassandra.startup=embedded
elasticsearch.startup=embedded
-
-cassandra.timeout=2000
+cassandra.timeout=5000
cassandra.connections=1000
-
-collection.stage.transient.timeout=60
-
-hystrix.threadpool.graph_user.coreSize=20
-hystrix.threadpool.graph_async.coreSize=20
+hystrix.threadpool.graph_user.coreSize=100
+hystrix.threadpool.graph_async.coreSize=100