From fcd3f3bba3284f7f92d6ac5440496e62062785df Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Thu, 2 Feb 2012 11:20:42 -0800 Subject: [PATCH] Make cassandra connection pool size configurable. --- r2/example.ini | 2 ++ r2/r2/lib/app_globals.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/r2/example.ini b/r2/example.ini index 79c05f349..973096fbb 100755 --- a/r2/example.ini +++ b/r2/example.ini @@ -117,6 +117,8 @@ rendercaches = 127.0.0.1:11211 permacache_memcaches = 127.0.0.1:11211 # cassandra hosts. one of these will be chosen at random by pycassa cassandra_seeds = 127.0.0.1:9160 +# number of connections to keep open to the cassandra ring +cassandra_pool_size = 5 # read/write consistency levels for Cassandra cassandra_rcl = ONE cassandra_wcl = ONE diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 3ccd6b7b5..85b1a78d6 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -69,6 +69,7 @@ class Globals(object): 'comment_visits_period', 'min_membership_create_community', 'bcrypt_work_factor', + 'cassandra_pool_size', ] float_props = ['min_promote_bid', @@ -236,7 +237,7 @@ class Globals(object): stats=self.stats, logging_name="main", server_list=self.cassandra_seeds, - pool_size=len(self.cassandra_seeds), + pool_size=self.cassandra_pool_size, timeout=2, max_retries=3, prefill=False