Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add Ability to configure Connection Pool Type #1

Merged
merged 5 commits into from

2 participants

@beckje01
Collaborator

Added the ability to configure the connection pool type, I also updated the example config and the doc to show the correct way to set more then one seed.

@bflorian bflorian merged commit 831205d into bflorian:master
@beckje01
Collaborator

Thanks, we have a vagrant set up that will help with this as well I'm working on getting it in a new repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 5, 2013
  1. @beckje01
  2. @beckje01
Commits on Jun 6, 2013
  1. @beckje01
Commits on Jun 18, 2013
  1. @beckje01

    Add codecoverage.

    beckje01 authored
    Update doc and config for using more then 1 seed.
  2. @beckje01

    Add default DSE path

    beckje01 authored
This page is out of date. Refresh to see the latest.
View
5 .gitignore
@@ -3,3 +3,8 @@
*.iml
stacktrace.log
target/
+grails-app/i18n/
+web-app/css/
+web-app/images/
+web-app/js/
+cobertura.ser
View
2  CassandraAstyanaxGrailsPlugin.groovy
@@ -19,7 +19,7 @@ import com.reachlocal.grails.plugins.cassandra.astyanax.AstyanaxDynamicMethods
class CassandraAstyanaxGrailsPlugin
{
// the plugin version
- def version = "0.3.3"
+ def version = "0.3.4-SNAPSHOT"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0.0 > *"
View
7 application.properties
@@ -1,7 +1,4 @@
#Grails Metadata file
-#Fri Nov 30 07:23:27 EST 2012
-app.grails.version=2.1.1
+#Wed Jun 05 14:56:29 CDT 2013
+app.grails.version=2.2.1
app.name=cassandra-astyanax
-plugins.hibernate=2.1.1
-plugins.release=2.0.4
-plugins.tomcat=2.1.1
View
52 grails-app/conf/BuildConfig.groovy
@@ -3,43 +3,43 @@ grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
- // inherit Grails' default dependencies
- inherits("global") {
- // uncomment to disable ehcache
- // excludes 'ehcache'
- }
- log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
- repositories {
- grailsPlugins()
- grailsHome()
- grailsCentral()
-
- // uncomment the below to enable remote dependency resolution
- // from public Maven repositories
- //mavenLocal()
- mavenCentral()
- //mavenRepo "http://snapshots.repository.codehaus.org"
- //mavenRepo "http://repository.codehaus.org"
- //mavenRepo "http://download.java.net/maven/2/"
- //mavenRepo "http://repository.jboss.com/maven2/"
- }
- dependencies {
- // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
+ // inherit Grails' default dependencies
+ inherits("global") {
+ // uncomment to disable ehcache
+ // excludes 'ehcache'
+ }
+ log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
+ repositories {
+ grailsPlugins()
+ grailsHome()
+ mavenCentral()
+ }
+ dependencies {
+ // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
runtime 'com.github.stephenc.high-scale-lib:high-scale-lib:1.1.1'
runtime 'com.github.stephenc.eaio-uuid:uuid:3.2.0'
- compile ('com.netflix.astyanax:astyanax:1.0.3') {
+ compile('com.netflix.astyanax:astyanax:1.0.3') {
excludes 'slf4j-log4j12', 'junit', 'commons-logging'
}
- }
+
+ test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
+
+ }
plugins {
- build (":svn:1.0.2") {
+
+ build(":tomcat:$grailsVersion",
+ ":release:2.2.1",
+ ":rest-client-builder:1.0.3") {
export = false
}
- test (":spock:0.6") {
+ test(":spock:0.7",
+ ":code-coverage:1.2.6") {
export = false
+ exclude "spock-grails-support"
}
+
}
}
View
13 grails-app/conf/Config.groovy
@@ -7,8 +7,11 @@ import com.netflix.astyanax.serializers.LongSerializer
astyanax {
clusters {
standard {
- seeds = ["localhost:9160"]
+ seeds = "10.0.10.60:9160,10.0.10.61:9160,10.0.10.62:9160"
defaultKeyspace = "AstyanaxTest"
+ connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.TOKEN_AWARE
+ discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.RING_DESCRIBE
+
columnFamilies {
AstyanaxTest {
LongColumnCF = new ColumnFamily("LongColumnCF", StringSerializer.get(), LongSerializer.get())
@@ -16,11 +19,15 @@ astyanax {
}
}
dummy1 {
- seeds = ["localhost:9160"]
+ connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.TOKEN_AWARE
+ discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.RING_DESCRIBE
+ seeds = "10.0.10.60:9160,10.0.10.61:9160,10.0.10.62:9160"
defaultKeyspace = "Dummy1Default"
}
dummy2 {
- seeds = ["localhost:9160"]
+ connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.TOKEN_AWARE
+ discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.RING_DESCRIBE
+ seeds = "10.0.10.60:9160,10.0.10.61:9160,10.0.10.62:9160"
}
}
defaultKeyspace = "OverallDefault"
View
6 grails-app/services/com/reachlocal/grails/plugins/cassandra/astyanax/AstyanaxService.groovy
@@ -16,7 +16,7 @@
package com.reachlocal.grails.plugins.cassandra.astyanax
-import org.codehaus.groovy.grails.commons.ConfigurationHolder
+import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType
import com.netflix.astyanax.thrift.ThriftFamilyFactory
import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor
import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl
@@ -167,12 +167,16 @@ class AstyanaxService implements InitializingBean
if (!context) {
def props = clusters[cluster]
+ //Default the pool type to the same default astyanax uses Round Robin.
+ ConnectionPoolType connectionPoolType = props.connectionPoolType ?: ConnectionPoolType.ROUND_ROBIN
def connectionPoolMonitor = props.connectionPoolMonitor ?: new CountingConnectionPoolMonitor()
def discoveryType = props.discoveryType ?: NodeDiscoveryType.NONE
def retryCount = props.retryCount ?: 3
def retryPolicy = props.retryPolicy ?: new RetryNTimes(retryCount)
+
def configuration = new AstyanaxConfigurationImpl()
+ .setConnectionPoolType(connectionPoolType)
.setDiscoveryType(discoveryType)
.setRetryPolicy(retryPolicy)
View
6 src/docs/guide/1.2 Configuration Options.gdoc
@@ -5,11 +5,12 @@ configuration:
astyanax {
clusters {
standard {
- seeds = ["localhost:9160"]
+ seeds = "localhost:9160"
defaultKeyspace = "AstyanaxTest"
port = 9160
maxConsPerHost = 10
retryCount = 3
+ connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.ROUND_ROBIN
connectionPoolMonitor = new com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor()
discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.NONE
retryPolicy = new com.netflix.astyanax.retry.RetryNTimes(3)
@@ -29,11 +30,12 @@ astyanax {
{table}
*Property* | *Required* | *Meaning*
-seeds | yes | Array of node strings of the form "host:port" that Astyanax will use in quering Cassandra
+seeds | yes | String of the form "host:port, host:port" that Astyanax will use in quering Cassandra
defaultKeyspace | no | Name of the keyspace to use if one is not specified in the service call
port | no | Port number used for communicating to Cassandra nodes. Defaults to 9160.
maxConsPerHost | no | The maximum number of connections to be created for any one node. Defaults to 10.
retryCount | no | The number of times Astyanax will retry a call before failing. Has not effect if the retryPolicy property is set. Defaults to 3.
+connectionPoolType | no | The connection pool type. Defaults to ROuND_ROBIN. Other values are TOKEN_AWARE, ROUND_ROBIN, and BAG
connectionPoolMonitor | no | The connection pool monitor implementation. Defaults to new com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor
discoveryType | no | The method of discovering new nodes. Defaults to NONE (no discovery). Other values are RING_DESCRIBE, DISCOVERY_SERVICE, and TOKEN_AWARE
retryPolicy | no | The retry policy to use. Defaults to RetryNTimes. Others values include RunOnce, ConstantBackoff, ExponentialBackoff, BoundedExponentialBackoff, and SleepingRetryPolicy
View
4 test/data/schema.txt
@@ -1,5 +1,7 @@
drop keyspace AstyanaxTest;
-create keyspace AstyanaxTest;
+CREATE KEYSPACE AstyanaxTest
+with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
+and strategy_options = [{replication_factor:3}];
use AstyanaxTest;
create column family User
View
2  test/integration/com/reachlocal/grails/plugins/cassandra/test/util/TestSchema.groovy
@@ -37,7 +37,7 @@ class TestSchema
}
static private runCqlScript(script) {
- def dsePath = System.getProperty('dsePath')
+ def dsePath = System.getProperty('dsePath') ?: '/usr/local/dse'
def cassandraCli = "$dsePath/bin/cassandra-cli -h localhost -f"
def cmd = "$cassandraCli $script"
Something went wrong with that request. Please try again.